JDBC driver

Driver:

A driver is a software component that provides the facility to a computer to communicate with hardware.

JDBC driver:

A driver is a software component that provides the facility to interact java application with the database.

Types of JDBC drivers:

  1. 1. JDBC-ODBC bridge driver.
  2. 2. Native-API driver.
  3. 3. Network-Protocol driver.
  4. 4. Thin driver.

1. JDBC-ODBC bridge driver:

JDBC-ODBC bridge driver is a native code driver which uses ODBC driver to connect with the database. It converts JDBC method calls into ODBC function calls. It is also known as Type 1 driver.

Advantages:

  1. 1. It can be used with any database for which an ODBC driver is installed.

Disadvantages:

  1. 1. Performance is not good as it converts JDBC method calls into ODBC function calls.
  2. 2. ODBC driver needs to be installed on the client machine.
  3. 3. Platform dependent.

2. Native-API driver:

Native-API driver uses the client-side libraries of the database. It converts JDBC method calls into native calls of the database API. It is partially written in java. It is also known as Type 2 driver.

Advantages:

  1. 1. It is faster than a JDBC-ODBC bridge driver.

Disadvantages:

  1. 1. Platform dependent.
  2. 2. The vendor client library needs to be installed on the client machine.

3. Network-Protocol driver:

Network-Protocol driver is a pure java driver which uses a middle-tier to converts JDBC calls directly or indirectly into database specific calls. Multiple types of databases can be accessed at the same time. It is a platform independent driver. It is also known as Type 3 or MiddleWare driver.

Advantages:

  1. 1. Platform independent.
  2. 2. Faster from Type1 and Type2 drivers.
  3. 3. It follows a three tier communication approach.
  4. 4. Multiple types of databases can be accessed at the same time.

Disadvantages:

  1. 1. It requires database-specific coding to be done in the middle tier.

4. Thin driver:

Thin driver is a pure java driver which converts JDBC calls directly into the database specific calls. It is a platform independent driver. It is also known as Type 4 or Database-Protocol driver.

Advantages:

  1. 1. Platform independent.
  2. 2. Faster than all other drivers.

Disadvantages:

  1. 1. It is database dependent.
  2. 2. Multiple types of databases can’t be accessed at the same time.

No comments: