JDBC Type 4 Driver 1.1 Programmer's Reference
-Djdbc.drivers=com.tandem.t4jdbc.SQLMXDriver
Uses the Class.forName method programmatically within the application:
Class.forName("com.tandem.t4jdbc.SQLMXDriver")
●
Adds the Type 4 driver class to the java.lang.System property jdbc.drivers property within the application:
jdbc.drivers=com.tandem.t4jdbc.SQLMXDriver
●
Establishing the Connection
The DriverManager.getConnection method accepts a string containing a Type 4 driver URL. The JDBC URL for the
Type 4 driver is:
jdbc:t4sqlmx://ip_address|machine_name:port_number/[:][property=value
[;property2=value2]...]
where
ip_address:port_number specifies the location where the NonStop MXCS association server is running.
property=value and property2=value2; specify a Type 4 driver property name-property value pair.
The pairs must be separated by a semicolon (;). For example,
T4LogLevel=ALL;T4LogFile=temp1.log
For information about the properties file, see Type 4 Driver Properties.
To establish a connection, the JDBC application can use the following code:
Class.forName("com.tandem.t4jdbc.SQLMXDriver"); //loads the driver
String url = “jdbc:t4sqlmx://ip_address|machine_name:port_number/”
Connection con = DriverManager.getConnection(url, “userID”, “Passwd”);
The variable con represents a connection to the MXCS data source that can be used to create and execute SQL statements.
Guidelines for Connections Using the Driver Manager
The Type 4 driver defines a set of properties that you can use to configure the driver. For detailed information about
these properties, see the Type 4 Driver Properties chapter.
●
Java applications can specify the properties in the following ways (listed in the order of precedence):
Using the java.util.Properties parameter in the getConnection method of DriverManager class.1.
Using the database URL in the DriverManager.getconnection method, where the URL is:
jdbc:t4sqlmx: //ip_addr|machine_name:port_num/property=value
2.
Using a properties file for the JDBC driver. The properties file is passed as a command-line parameter. The format
to enter the properties file in the command line is:
-Dt4sqlmx.properties=location-of-the-properties-file-on-disk
For example, -Dt4sqlmx.properties=C:\temp\t4props
For information about the properties file, see Creating and Using a Properties File in the Type 4 Driver Properties
chapter.
3.
Using JDBC properties with the -D option in the command line. If used, this option applies to all JDBC
connections using the DriverManager within the Java application. The format in the command line is:
-Dt4sqlmx.property_name=property_value
For example, -Dt4sqlmx.maxStatements=1024
4.
●