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.
The driver, MIMJDBC3.JAR, supports the JDBC 3 standard, and is for Java 1.4 or later.
For more information about Java and JDBC, please see:
- SYS$COMMON:[JAVA*.DOCS]INDEX.HTML - Java information for more recent versions
- MIMDOC:MIMJDBEN.PDF - Information on the Mimer JDBC driver.
- http://www.oracle.com/technetwork/java/javase/jdbc/index.html - JDBC technology information.
Using the JDBC Driver
To use the JDBC driver, you must first set up the OpenVMS Java environment.
Defining Java Commands
Use the following command to define the Java 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 MIMLIB:MIMJDBC3.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")+":/MIMLIB/MIMJDBC3.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 3.31 (12385)
Testing the Connection
Use the -ping switch to test that the driver can make a connection with a Mimer SQL v10.1 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(): 10.01.0001 MIMER/DB 10.1.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 MIMEXAMPLES: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