The IBM® Data Server Driver for JDBC and SQLJ supports two types of connectivity: type 2 connectivity and type 4 connectivity.
For the DriverManager interface, you specify the type of connectivity through the URL in the DriverManager.getConnection method. For the DataSource interface, you specify the type of connectivity through the driverType property.
Function | IBM Data Server Driver for JDBC and SQLJ type 2 connectivity support | IBM Data Server Driver for JDBC and SQLJ type 4 connectivity support |
---|---|---|
Sysplex workload balancing and connection concentrator | Supported through DB2 Connect™ | Supported directly by the driver for a connection
within a single JVM Supported through DB2 Connect across JVMs |
Communication protocols | TCP/IP | TCP/IP |
Performance | Better for accessing a local data server | Better for accessing a remote data server |
Installation | Requires installation of native libraries in addition to Java™ classes | Requires installation of Java classes only |
Stored procedures | Can be used to call or execute stored procedures | Can be used only to call stored procedures |
Distributed transaction processing (XA) | Supported | Supported |
J2EE 1.4 compliance | Compliant | Compliant |
The following points can help you determine which type of connectivity to use.
Use IBM Data Server Driver for JDBC and SQLJ type 2 connectivity under these circumstances:
Local applications have better performance with type 2 connectivity.
A stored procedure environment consists of two parts: a client program, from which you call a stored procedure, and a server program, which is the stored procedure. You can call a stored procedure in a JDBC or SQLJ program that uses type 2 or type 4 connectivity, but you must run a Java stored procedure using type 2 connectivity.
Use IBM Data Server Driver for JDBC and SQLJ type 4 connectivity under these circumstances:
Remote applications have better performance with type 4 connectivity.