Similar to DB2 CLI, you do not have to precompile or bind a JDBC program. As a
vendor neutral standard, JDBC applications offer increased portability. The
JDBC API, which is similar to the CLI/ODBC API, provides a standard way to
access databases from Java code. The Java code passes SQL statements to the
DB2 JDBC driver, which handles the JDBC API calls. Java's portability enables
the delivery of DB2 access to clients on multiple platforms, requiring only a
Java enabled Web browser, or a Java runtime environment.
DB2 Version 8 offers different ways of creating Java applications, either using a
type 2, type 3, or type 4 JDBC driver:
Type 2 driver
:
With a type 2 driver, calls to the JDBC application driver are translated to
Java native methods. The Java applications that use this driver must run on a
DB2 client, through which JDBC requests flow to the DB2 server. This is
typically how DB2 is accessed by WebSphere Application Server.
Tip:
If you want to prototype CLI calls before placing them in a program,
you can use the
db2cli.exe
(Windows) or
db2cli
(Linux) file in the
sqllib/samples/cli
directory. There is also a document called INTCLI.DOC,
which advises you about how to use the utility.
Type 3 driver
:
The DB2 JDBC type 3 driver, also known as the applet or net driver, consists
of a JDBC client and a JDBC server. The DB2 JDBC applet driver can be
loaded by the Web browser along with the applet. Another way is to use the
applet driver in standalone Java applications. When the applet requests a
connection to a DB2 database, the applet driver opens a TCP/IP socket to the
DB2 JDBC applet server, which is the machine where the Web server
resides. After a connection is set up, the applet driver sends each of the
subsequent database access requests from the applet to the JDBC server
through the TCP/IP connection. The JDBC server then makes corresponding
DB2 calls to perform the task. Upon completion, the JDBC server sends the
results back to the JDBC client through the connection. The use of the type 3
driver is being deprecated with DB2 Version 8 because of the new type 4
driver.
Type 4 driver
:
The JDBC type 4 driver, which is new for Version 8, can be used to create
both Java applications and applets. To run an applet that is based on the type
4 driver, only a Java enabled browser is required, which downloads the applet
and the JDBC driver (db2jcc.jar). To run a DB2 application with a type 4
driver, only an entry for the JDBC driver in the
class path
and no DB2 client is
required. This type 4 driver provides the initial implementation of the new
26
MySQL to DB2 UDB Conversion Guide
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved