422 Robust Data Synchronization with IBM Tivoli Directory Integrator
Figure A-1 Connection to Oracle database
Database connectivity to DB2
Based on the JDBC driver architecture DB2JDBC drivers are divided into four
types.
Appendix A. Tricky connections 423
1. DB2 JDBC Type 1
A JDBC Type 1 driver is built into Java and basically provides a JDBC-ODBC
bridge. It is typically not used any more.
A JDBC Type 1 driver can be used by JDBC 1.2 JDBC 2.0, and JDBC 2.1.
2. DB2 JDBC Type 2
The DB2JDBC Type 2 driver is quite popular and is often referred to as the
app driver. The app driver name comes from the notion that this driver will
perform a native connect through a local DB2 client to a remote database,
and from its package name (COM.ibm.db2.jdbc.app.*).
In other words, you have to have a DB2 client installed on the machine where
the application that is making the JDBC calls runs. The JDBC Type 2 driver is
a combination of Java and native code, and will therefore always yield better
performance than a Java-only Type 3 or Type 4 implementation.
This driver's implementation uses a Java layer that is bound to the native
platform C libraries. Programmers using the J2EE™ programming model will
gravitate to the Type 2 driver as it provides top performance and complete
function. It is also certified for use on J2EE servers.
The implementation class name for this type of driver is
com.ibm.db2.jdbc.app.DB2Driver.
The JDBC Type 2 drivers can be used to support JDBC 1.2, JDBC 2.0, and
JDBC 2.1.
3. DB2 JDBC Type 3
The JDBC Type 3 driver is a pure Java implementation that must talk to
middleware that provides a DB2 JDBC Applet Server. This driver was
designed to enable Java applets to access DB2 data sources. An application
using this driver can talk to another machine where a DB2 client has been
installed.
The JDBC Type 3 driver is often referred to as the
net driver, appropriately
named after its package name (COM.ibm.db2.jdbc.net.*).
The implementation class name for this type of driver is
com.ibm.db2.jdbc.net.DB2Driver
The JDBC Type 3 driver can be used with JDBC 1.2, JDBC 2.0, and JDBC
2.1.
4. DB2 JDBC Type 4
The JDBC Type 4 driver is also a pure Java implementation. An application
using a JDBC Type 4 driver does not need to interface with a DB2 client for
connectivity because this driver comes with Distributed Relational Database
424 Robust Data Synchronization with IBM Tivoli Directory Integrator
Architecture™ Application Requester (DRDA® AR) functionality built into the
driver.
The implementation class name for this type of driver is
com.ibm.db2.jcc.DB2Driver.
Obtaining the drivers
IBM Tivoli Directory Integrator ships with DB2 JDBC drivers.
The driver files are also available on the datasource you are trying to connect to
and where DB2 has been installed. Look for the driver files under the
[DB2_HOME]/java directory. The drivers may be in the form of jar or zip file.
Legacy CLI-based JDBC drivers are provided in the file db2java.zip. The
universal JDBC drivers are provided in the file db2cc.jar.
Installing the drivers
There are two ways you can install the drivers on the Tivoli Directory Integrator
system.
1. Copy the driver file to the [TDI_HOME]/jars directory.
2. Copy the driver file to any directory of your choice and then add this file
including the fully qualified path to the CLASSPATH of your system.
Driver configuration
This section describes the driver configuration within the context of Tivoli
Directory Integrator.
򐂰 JDBC URL
The JDBC URL configuration depends on the driver type you want to use.
Table A-2 on page 425 shows the JDBC URL syntax.
Note: Ensure that multiple versions of the driver are not present in the
CLASSPATH.

Get Robust Data Synchronization with IBM Tivoli Directory Integrator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.