by BehindJava

What are available JDBC drivers and difference between them and when to use

Home » java » What are available JDBC drivers and difference between them and when to use

In this tutorial we are going to learn about JDBC drivers in detail.

JDBC API uses JDBC drivers to connect with the database. There are four types of JDBC drivers:

  • JDBC-ODBC Bridge Driver: The JDBC-ODBC bridge driver uses ODBC driver to connect to the database. The JDBC-ODBC bridge driver converts JDBC method calls into the ODBC function calls. This is now discouraged because of thin driver. In Java 8, the JDBC-ODBC Bridge has been removed.
  • Native Driver: The Native API driver uses the client-side libraries of the database. The driver converts JDBC method calls into native calls of the database API. It is not written entirely in java.
  • Network Protocol Driver: The Network Protocol driver uses middleware (application server) that converts JDBC calls directly or indirectly into the vendor-specific database protocol. It is fully written in java.
  • Thin Driver: The thin driver converts JDBC calls directly into the vendor-specific database protocol. That is why it is known as thin driver. It is fully written in Java language.

We can use JDBC API to handle database using Java program and can perform the following activities:

  1. Connect to the database
  2. Execute queries and update statements to the database
  3. Retrieve the result received from the database.