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.
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 |
---|---|---|
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) | Not supported | Supported |
J2EE 1.4 compliance | Compliant | Compliant |
CICS® environment | Supported | Not supported |
IMS environment | Supported | Not supported |
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:
- Your JDBC or SQLJ application runs locally most of the time.
Local applications have better performance with type 2 connectivity.
- You are running a Java stored
procedure.
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.
- Your application runs in the CICS environment or IMS environment.
Use IBM Data Server Driver for JDBC and SQLJ type 4 connectivity under these circumstances:
- Your JDBC or SQLJ application runs remotely most of the time.
Remote applications have better performance with type 4 connectivity.
- You are using IBM Data Server Driver for JDBC and SQLJ connection concentrator and sysplex workload balancing support.