NonStop Server for Java (NSJ) Programmer's Guide (NSJ 2.1+)
Loading a Driver
To load a JDBC driver, load its JDBC driver class (not the JDBC driver file, whose name has the suffix .class) into the Java
Virtual Machine (JVM) in one of the following ways:
Specify the JDBC driver class on the java command line.●
Add the JDBC driver class to the jdbc.drivers property.●
Load the JDBC driver class directly into the JVM.●
The first two of the preceding ways allow you to change drivers without modifying your program code; the third way does not.
The standard SQL/MP driver and the transaction-aware driver share the same code, so you use the same syntax to load either
of them.
Note: The SQL/MP driver file, com/tandem/sqlmp/SQLMPDriver.class, is stored in the JAR file
sqlmp.jar, which contains Compaq additions to the JVM. The SQL/MP driver file belongs to the JDBC driver
class com.tandem.sqlmp.SQLMPDriver.
The following figure shows a JDBC driver class being loaded into the JVM, which already contains the JDBC
DriverManager and three databases.
Loading a JDBC Driver Class Into the JVM
Legend
JDBC driver class1.
Java Virtual Machine (JVM)2.
JDBC Driver Manager3.
SQL/MP database4.
Oracle database5.
JavaDB database6.
Specifying the JDBC Driver Class on the java Command Line
To specify the JDBC driver class on the java command line, use the -Djdbc.drivers option. For example, the following
java command loads the SQL/MP driver, whose class name is com.tandem.sqlmp.SQLMPDriver:
java -Djdbc.drivers=com.tandem.sqlmp.SQLMPDriver
To specify multiple JDBC driver classes on the java command line, separate them with semicolons. For example, the
following java command loads the SQL/MP driver and a driver whose class name is
com.javaco.purejavajdbc.Driver: