CodesJava

Easy learning with example program codes

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. JDBC-ODBC bridge driver.
  2. Native-API driver.
  3. Network-Protocol driver.
  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. It can be used with any database for which an ODBC driver is installed.

Disadvantages:

  1. Performance is not good as it converts JDBC method calls into ODBC function calls.
  2. ODBC driver needs to be installed on the client machine.
  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. It is faster than a JDBC-ODBC bridge driver.

Disadvantages:

  1. Platform dependent.
  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. Platform independent.
  2. Faster from Type1 and Type2 drivers.
  3. It follows a three tier communication approach.
  4. Multiple types of databases can be accessed at the same time.

Disadvantages:

  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. Platform independent.
  2. Faster than all other drivers.

Disadvantages:

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

 
Next Topic: Connect to Oracle database with JDBC driver.
Previous Topic: JDBC overview.

Related Topics:

How to build java project using ant in eclipse?
JAXB marshalling – convert java object to xml example.
How to create pdf file in java using iText jar?
Generics class example.
OGNL in struts 2.
Hibernate One-to-One Mapping using xml.
Send inline image in email using JavaMail API.
Quartz 2 JobListener example.

 



Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap