Description of DB2 database driver types

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

The description of the DB2 database driver type is the main content of this article. At the same time, this article also describes the early CLI-based Drivers, recent pure Java drivers, and the 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 DB2 database systems of many versions and the access drivers of many versions is quite complicated. 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 db2through JDBC. The call to DB2 JDBC type 2 driver is converted to a Java local method. java applications using this driver must run on a DB2 client, and JDBC requests are 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 drivers are: db2jcc. jar and sqlj.zip files, sqllib \ bin \ db2jcct2. 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:

 
 
  1. import java.sql.*;   
  2. public class Employee {   
  3. /**   
  4. * @param args   
  5. */   
  6. public static void main(String[] args) {   
  7. // TODO Auto-generated method stub   
  8. Employee ee = new Employee();   
  9. try {   

Ee. testJcc (); // succeeded

Ee. testNet (); // succeeded

Ee. testApp (); // the error message returned when the DB2 access client needs to be installed for Type 2. if you want to access the remote DB2 database through type 2, you can catalog the remote database locally.

 
 
  1. } catch (Exception e) {   
  2. e.printStackTrace();   
  3. }   
  4. }   
  5. /**  

The above content is an introduction to the DB2 database driver type, and I hope you will get something.

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.