IBM DB2 Manual page 34

Table of Contents

Advertisement

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 2. 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
Performance
Installation
Stored procedures
Distributed transaction processing
(XA)
J2EE 1.4 compliance
CICS environment
IMS environment
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:
v Your JDBC or SQLJ application runs locally most of the time.
v You are running a Java stored procedure.
v 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:
v Your JDBC or SQLJ application runs remotely most of the time.
v You are using IBM Data Server Driver for JDBC and SQLJ connection
18
Application Programming Guide and Reference for Java
IBM Data Server Driver for JDBC
and SQLJ type 2 connectivity
support
Better for accessing a local DB2 server Better for accessing a remote DB2
Requires installation of native
libraries in addition to Java classes
Can be used to call or execute stored
procedures
Not supported
Compliant
Supported
Supported
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.
Remote applications have better performance with type 4 connectivity.
concentrator and Sysplex workload balancing support.
Related tasks
"Connecting to a data source using the DriverManager interface with the IBM
Data Server Driver for JDBC and SQLJ" on page 11
Related reference
"Properties for the IBM Data Server Driver for JDBC and SQLJ" on page 201
IBM Data Server Driver for JDBC
and SQLJ type 4 connectivity
support
server
Requires installation of Java classes
only
Can be used only to call stored
procedures
Supported
Compliant
Not supported
Not supported

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents