DB2 database driver types

Source: Internet
Author: User
Tags db2 client db2 connect db2 driver ibm database

IBM's DB2 database is widely used. This article will introduce you to the description of the DB2 database driver type, which has a specific driver for a specific DB2 version and a general driver. If you are interested in this aspect, take a look.

The Data Access APIs provided by different versions of the IBM database product line are already a lot, including the earliest CLI-based Drivers and recent pure Java drivers, and a combination of CLI and Java.

For a specific DB2 version, the driver has a specific driver and a general driver, which is obvious.

General description

In the database product line of IBM, there are many data access APIs provided by different versions, including the early CLI-based Drivers and recent pure Java drivers, and a combination of CLI and Java. for a specific DB2 version, the driver has a specific driver and a general driver, which is obvious. however, the relationship between the database systems of many versions and the access drivers of many versions is complicated for customers.

Therefore, when using IBM database products, you must pay attention to the version correspondence and selection of appropriate generic drivers. fortunately, IBM has begun to unify and pay attention to ease of use. These efforts have started from DB2 UDB V7. since then, according to the JDBC driver type in the Java field, IBM has three types of drivers.

The jdbc type 2 driver of DB2 enables Java applications to call the DB2 driver TYPE through JDBC. the call to DB2 JDBC type 2 driver is converted to a Java local method. java applications using such drivers must run on a DB2 client.

The JDBC request is forwarded to the DB2 server through this client. before using the DB2 JDBC application driver to access the data source in the DB2 UDB for iSeries or DB2 for OS/390 or z/OS environment, you must install DB2 Connect Version 8. DB2 JDBC type 2 driver supports most of the JDBC and SQLJ functions described in the JDBC 1.2 specification, and supports some functions described in the JDBC 2.0 specification.

DB2 jdbc type 3 driver, also known as applet or net driver, consists of a JDBC client and a JDBC server (the process name is db2jd. it can be used in the Applet or in the application.

DB2's jdbc type 4 driver is called a universal driver and implemented in Java only. This driver also supports SQLJ.

Currently, no JDBC driver for TYPE 1 is provided by IBM.

The packages of these types of drivers are: db2 driver type jcc. jar and sqlj.zip files, sqllibbindb2jcct2. dll (this file is required by type2 ).

Use

When connecting DB2 UDB V7.2 and DB2 UDB V8.1 using JDBC, if you encounter some confusing problems, you can check the JDK used in the development environment, switching from a known JDK provided by IBM (with versions 1.3 and 1.4) often solves your problem.

In the DB2 UDB V8.2 Personal Edition, the following test code Tests Three connection methods and provides the results:

Import java. SQL. *; public class Employee {/*** @ param args */public static void main (String [] args) {// TODO Auto-generated method stub Employee ee = new Employee (); try {ee. testJcc (); successful

Ee. testNet (); successful

Ee. testApp (); failed because: Type 2 requires the DB2 driver type access client to be installed. The test is not installed. if you want to access the remote database through type 2, you can catalog the remote database locally.

} Catch (Exception e) {e. printStackTrace ();}}/**

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.