DB2 10.5 for Linux, UNIX, and Windows

How to determine which type of IBM Data Server Driver for JDBC and SQLJ connectivity to use

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.

The following table summarizes the differences between type 2 connectivity and type 4 connectivity:
Table 1. Comparison of IBM Data Server Driver for JDBC and SQLJ type 2 connectivity and IBM Data Server Driver for JDBC and SQLJ type 4 connectivity
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:

Use IBM Data Server Driver for JDBC and SQLJ type 4 connectivity under these circumstances: