Sunday, 9 June 2013

JDBC driver


A Java program that uses the JDBC API loads the specified driver for a particular DBMS before it actually connects to a database. The JDBC DriverManager class then sends all JDBC API calls to the loaded driver.
The four types of JDBC drivers are:

1. Type 1: JDBC-ODBC Bridge Driver

Translates JDBC API calls into Microsoft Open Database Connectivity (ODBC) calls that are then passed to the ODBC driver. The ODBC binary code must be loaded on every client computer that uses this type of driver.
JDBC Type 1 Driver

2. Type 2: JDBC-Native API

Converts JDBC API calls into DBMS-specific client API calls. Like the bridge driver, this type of driver requires that some binary code be loaded on each client computer.
JDBC Type 2 Driver

3. Type 3: JDBC-Net pure Java

Sends JDBC API calls to a middle-tier net server that translates the calls into the DBMS-specific network protocol. The translated calls are then sent to a particular DBMS.
JDBC Type 3 Driver

4. Type 4: 100% pure Java

Converts JDBC API calls directly into the DBMS-specific network protocol without a middle tier. This allows the client applications to connect directly to the database server.
JDBC Type 4 Driver