JDBC Drivers

Last Updated : 6 Apr, 2026

JDBC drivers enable Java applications to communicate with different databases by converting JDBC calls into database-specific commands. These drivers are essential for connecting and interacting with databases.

  • JDBC classes are available in java.sql and javax.sql packages
  • Used to connect to databases like MySQL, Oracle, PostgreSQL
  • Allows executing SQL queries and retrieving results

Structure of JDBC Driver

The JDBC Driver structure shows how a Java application interacts with a database using the JDBC API. The API communicates with the DriverManager, which selects the appropriate driver to establish the connection.

  • Application -> JDBC API -> DriverManager Database
  • DriverManager manages multiple database drivers
  • Enables connection to databases like MySQL, Oracle, SQL Server
JDBC-Architecture
JDBC Driver Structure

Types of JDBC Drivers

JDBC drivers are categorized into four types based on how they communicate with the database. Each type differs in performance, portability, and dependency on native libraries.

1. JDBC-ODBC Bridge Driver - Type 1 Driver

Type-1 driver or 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. Type-1 driver is also called Universal driver because it can be used to connect to any of the databases.

JDBC-ODBC_bridge_driver

Advantages

  • This driver software is built-in with JDK so no need to install separately.
  • It is a database independent driver.

Disadvantages

  • This driver introduces additional layers (JDBC -> ODBC), which increases complexity and may lead to performance overhead and potential misconfiguration issues
  • The ODBC bridge driver is needed to be installed in individual client machines.
  • Type-1 driver isn't written in java, that's why it isn't a portable driver.

Note: This driver was removed from JDK 8 onwards and is now considered obsolete

2. Native-API Driver - Type 2 Driver ( Partially Java Driver)

The Native API driver uses the client -side libraries of the database. This driver converts JDBC method calls into native calls of the database API. In order to interact with different database, this driver needs their local API, that's why data transfer is much more secure as compared to type-1 driver. This driver is not fully written in Java that is why it is also called Partially Java driver.

Native-API_driver

Advantage

  • Native-API driver gives better performance than JDBC-ODBC bridge driver.
  • Provides better performance than Type-1 driver due to direct interaction with native database APIs.

Disadvantages

  • Driver needs to be installed separately in individual client machines
  • The Vendor client library needs to be installed on client machine.
  • Type-2 driver isn't written in java, that's why it isn't a portable driver
  • It is a database dependent driver.

3. Network Protocol Driver - Type 3 Driver (Fully Java Driver)

The Network Protocol driver uses middleware (application server) that converts JDBC calls directly or indirectly into the vendor-specific database protocol. Here all the database connectivity drivers are present in a single server, hence no need of individual client-side installation.

Network_protocol_driver

Advantages

  • Type-3 drivers are fully written in Java, hence they are portable drivers.
  • No client side library is required because of application server that can perform many tasks like auditing, load balancing, logging etc.
  • Easy to switch databases

Disadvantages

  • Network support is required on client machine.
  • Maintenance of Network Protocol driver becomes costly because it requires database-specific coding to be done in the middle tier.

4. Thin Driver - Type 4 Driver (Fully Java Driver)

Type-4 driver is also called native protocol driver. This driver interact directly with database. It does not require any native database library, that is why it is also known as Thin Driver.

Thin_driver

Advantages

  • Does not require any native library and Middleware server, so no client-side or server-side installation.
  • It is fully written in Java language, hence they are portable drivers.

Disadvantage

  • If the database changes, a new driver may be needed.

When to Use Which Driver?

  • If you are accessing one type of database, such as Oracle, Sybase or IBM, the preferred driver type is type-4.
  • If your Java application is accessing multiple types of databases at the same time, type 3 is the preferred driver.
  • Type 2 drivers are useful in situations, where a type 3 or type 4 driver is not available yet for your database.
  • The type 1 driver is not considered a deployment-level driver and is typically used for development and testing purposes only.
Comment