Using the JDBC Driver
The Mimer SQL distribution includes a JDBC driver. This driver enables Java programs running on OpenVMS to access any Mimer SQL database server running at least version 8.2.
The JDBC driver is a `type 4' driver which means that it is written entirely in Java, and can be moved to any platform supporting Java.
Three drivers are supplied. Each driver support a different JDBC standard. Pick the one that best matches your needs.
MIMJDBC1.JAR JDBC 1. Java 1.1.8 or later MIMJDBC2.JAR JDBC 2 Java 1.2 to Java 1.3 MIMJDBC3.JAR JDBC 3 Java 1.4 or later
For more information about Java and JDBC, please see:
JDK118_VMS_RELEASE_NOTES.HTML - Java 1.1.8 information (old)
- SYS$COMMON:[JAVA*.DOCS]INDEX.HTML - Java information for more recent versions
- MIMDOC9:MIMJDBEN.PDF - Information on the Mimer JDBC driver.
- http://java.sun.com/products/jdbc - JDBC technology information from Sun.
Using the JDBC Driver
To use the JDBC driver, you must first set-up the OpenVMS Java environment.
Defining Java Commands
When using Java 1.1.8, use the following commands to define the Java commands:$ DEASSIGN JAVA$USE_DCL $ @SYS$MANAGER:JAVA$SETUP
When using a more recent Java version, use the following commands (Java version 1.4.2 is used in the example):$ @SYS$MANAGER:JAVA$142_SETUP
To use a Mimer JDBC driver, the Java environment must be able to find it.
The logical name CLASSPATH is used for this purpose. This logical name contains a list of directories and Java archives (.ZIP and .JAR files).
On OpenVMS you can use either the JAVA$CLASSPATH or CLASSPATH logical name to specify a Java classpath. The JAVA$CLASSPATH logical name is easier to use since it uses standard OpenVMS file specifications.
Example$ DEFINE JAVA$CLASSPATH MIMLIB9:MIMJDBC2.JAR, SYS$DISK:
It is also possible to use the CLASSPATH logical name. This logical name uses a UNIX syntax to specify a search path. Please read the OpenVMS Java documentation for details.
The following example sets the CLASSPATH logical name to include the Mimer JDBC 1 driver.
Since the equivalence string becomes rather long, and must be enclosed in quotes, a DCL string is constructed.
Example$ SHOW LOG CLASSPATH "CLASSPATH" = "/sys$common/java/lib/JDK118_CLASSES.ZIP:." (LNM$PROCESS_TABLE) $ CLASSPATH=F$TRNLNM("CLASSPATH")+":/MIMLIB9/MIMJDBC1.JAR" $ DEFINE CLASSPATH "''CLASSPATH'"
The Mimer JDBC driver should now be accessible.
Note: Using logical names that enclose directory specifications with < and > is problematic in Java. Please make sure you use [ and ] instead.
Verifying the Environment
Since the driver contains a main() function, it is possible to execute it as a program for testing purposes.
Use the -version switch to verify that the Java environment can locate and use the Mimer JDBC driver. Note that quotes must be used since Java package names are case sensitive.$ JAVA "com.mimer.jdbc.Driver" -version Mimer JDBC driver version 2.14
Testing the Connection
Use the -ping switch to test that the driver can make a connection with a Mimer SQL v9.2 database server.
Please read the JDBC driver guide for an explanation of the syntax of the connection URL.$ JAVA "com.mimer.jdbc.Driver" -ping - $_ "jdbc:mimer://SYSADM:PASSWORD@mynode/testdb" Database connection established. getDatabaseProductName(): MIMER/DB getDatabaseProductVersion(): 09.02.0001 MIMER/DB 9.2.01 Ping tests: 0 2 ms 1 2 ms 2 1 ms 3 1 ms 4 1 ms 5 1 ms 6 0 ms 7 2 ms 8 1 ms 9 1 ms avg 1 ms min 0 ms max 2 ms
Finally, compile and execute the JDBC example program. You should copy the example program to a private directory and edit it in order to set the connection URL string, database user name and passwords.$ SET DEF [SOMEWHERE.PRIVATE] $ COPY MIMEXAMPLES9:EXAMPLE.JAVA  $ ! Edit the example. Alter the URL and username/password $ EDIT EXAMPLE.JAVA $ JAVAC EXAMPLE.JAVA $ JAVA "Example"
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40