Chapter 3. Connectivity with DB2 UDB for iSeries 77
Type 1 are drivers that implement the JDBC API as a mapping to another
data access API, such as Open Database Connectivity (ODBC). Drivers of
this type are generally dependent on a native library, which limits their
portability. The JDBC-ODBC Bridge driver is an example of a Type 1 driver.
Type 2 are drivers that are written partly in the Java programming language
and partly in native code. The drivers use a native client library specific to the
data source to which they connect. Again, because of the native code, their
portability is limited.
Type 3 are drivers that use a pure Java client and communicate with a
middleware server using a database-independent protocol. The middleware
server then communicates the client’s requests to the data source.
Type 4 are drivers that are pure Java and implement the network protocol for
a specific data source. The client connects directly to the data source.
3.8.2 JDBC drivers provided by DB2 UDB for Linux
DB2 UDB for Linux provides Type 2, Type 3, and Type 4 JDBC drivers. DB2 UDB
for Linux Type 2 and Type 3 drivers use the DB2 CLI (Call Level Interface)
interface to communicate to DB2 UDB servers. The JDBC Type 2 and Type 3
drivers are provided in the db2java.zip file located in the sqllib/java directory.
DB2 Version 8 adds a new DB2 JDBC Universal Driver (Type 4), which uses the
Distributed Relational Database Architecture™ (DRDA) protocol for client/server
communications. This new driver is provided in the db2jcc.jar file in the
sqllib/java directory. In DB2 UDB 8.1.2, the DB2 JDBC Universal Driver also
can be used as a Type 2 driver.
Type 2 driver (Application driver)
Figure 3-34 illustrates the mechanism in which the type 2 JDBC driver works.
The client layer is added for explanation purposes, but the client facility can also
reside in Linux.
78 DB2 UDB for Linux on iSeries: Implementation Guide
Figure 3-34 Type 2 JDBC driver provided by DB2 UDB for Linux
The type 2 driver, which is called “DB2 JDBC application driver” enables Java
applications to make calls to DB2 through JDBC. The Java applications that use
this driver must run on a DB2 Client, through which JDBC requests flow to the
DB2. DB2 Client is the “native client library” needed for the type 2 driver in this
case. When you use the type 2 driver in the Linux, you do not need DB2 Client,
because the DB2 UDB for Linux server also has the client facility. If you want to
access DB2 UDB for iSeries by this driver, DB2 Connect Version 8
license/installation is required in the Linux partition.
Type 3 driver (Applet driver or net driver)
Figure 3-35 illustrates the mechanism in which the type 3 JDBC driver works.
The client layer is added for explanation purposes but the client facility can also
reside in Linux.
Note: In reality, you don’t need DB2 Client product on the client machine as far
as your client and Linux partition with DB2 UDB for LUW installed is the same
machine (that is, in the same Linux LPAR partition). This is because it is
integrated in every edition of DB2 for UDB for LUW available for iSeries.
DB2 Engine
DB2 UDB
for iSeries
OS/400
DRDA AS
DB2 Engine
DB2 UDB
for Linux
Linux
DB2 Connect
(DRDA AR)
Java program
DB2
Type2
JDBC driver
DB2 Client
(CLI interface)
Client
Get DB2 for Linux on iSeries: Implementation Guide 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.