|
|
Using the JDBC Driver
To use the JDBC driver, you must first set-up the OpenVMS Java environment.
Defining Java Commands
Use the following commands to define the Java commands:
$ DEASSIGN JAVA$USE_DCL $ @SYS$MANAGER:JAVA$SETUPSetting CLASSPATH
To use the 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).
Please note that the CLASSPATH logical name specifies the file names using a UNIX syntax. It is also possible to use the JAVA$CLASSPATH logical name which uses standard VMS file specifications. Please read the VMS Java release notes for further details.
The following example first determines the exact version of the file to be used, and then sets the CLASSPATH logical name accordingly.
Since the equivalence string becomes rather long, and must be enclosed in quotes, a DCL string is constructed.
Example
$ DIR MIMLIB8:MIMJDBC*.JAR Directory MIMROOT8:<LIBRARY> MIMJDBC-1_3.JAR;1 Total of 1 file. $ SHOW LOG CLASSPATH "CLASSPATH" = "/sys$common/java/lib/JDK118_CLASSES.ZIP:." (LNM$PROCESS_TABLE) $ CLASSPATH=F$TRNLNM("CLASSPATH")+":/MIMLIB8/MIMJDBC-1_3.JAR" $ DEFINE CLASSPATH "''CLASSPATH'"The Mimer JDBC driver should now be accessible.
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 1.3Testing the Connection
Use the -ping switch to test that the driver can make a connection with a Mimer SQL v8.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/mydatabase" Database connection established. getDatabaseProductName(): MIMER/DB getDatabaseProductVersion(): 08.02.0001 MIMER/DB 8.2.04 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 msFinally, 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 MIMEXAMPLES8:EXAMPLE.JAVA [] $ ! Edit the example. Alter the URL and username/password $ EDIT EXAMPLE.JAVA $ JAVAC EXAMPLE.JAVA $ JAVA "Example"
|
Upright Database Technology AB Voice: +46 18 780 92 00 Fax: +46 18 780 92 40 dbtechnology@upright.se |
|
|