Java Design Pattern
Introduction to Java 10
Introduction to Java 11
Introduction to Java 12

JDBC Drivers

JDBC Driver is a software component that enables java application to interact with the database. There are 4 types of JDBC drivers:

  • 1. Type 1 Driver(JDBC-ODBC bridge driver)
  • 2. Type 2 Driver(Native-API driver)
  • 3. Type 3 Driver(Net Protocol driver)
  • 4. Type 4 Driver(Thin driver / fully java driver)
JDBC Type-1 Driver (JDBC-ODBC bridge driver):

In a Type 1 driver, a JDBC bridge is used to access ODBC drivers installed on each client machine. Using ODBC requires configuring on your system a Data Source Name (DSN) that represents the target database. When Java first came out, this was a useful driver because most databases only supported ODBC access but now this type of driver is recommended only for experimental use or when no other alternative is available.


  • • Serves as a single driver that can be used to interact with different data stores.
  • • Allows you to communicate with all the databases supported by the ODBC driver.
  • • Represents as a vendor independent driver and is available along with in-built JDK.
  • • Decreases the execution speed due to the more number of translations(includes JDBC->ODBC->DB Native calls).
  • • Depends on the ODBC driver due to which Java applications indirectly become dependent on ODBC drivers.
  • • Requires ODBC binary code(or ODBC client library) that must be installed on every client to access data from the database.
  • Note: Type-1 driver is not supported by JDK 1.8(java8).
JDBC Type 2 Driver (Native-API driver):

In Type 2 driver, JDBC API calls are converted into native C/C++ API calls which are unique to the database. These drivers typically provided by the database vendors and used in the same manner as the JDBC-ODBC Bridge, the vendor-specific driver must be installed on each client machine.
If we change the Database we have to change the native API as it is specific to a database and they are mostly obsolete now but you may realize some speed increase with a Type 2 driver, because it eliminates ODBC’s overhead.


The Oracle Call Interface (OCI) driver is an example of a Type 2 driver.

  • • Serves as the fastest driver compared to other type of drivers.
  • • Requires native libraries which must be installed on client machine since the conversion from JDBC calls to database specific native calls is done on the client machine.
  • • Allows the database specific native functions to be executed on the client JVM process and any bug in this driver can crash JVM.
  • • Increases the cost of the application id the application needs to run on different platforms.
JDBC Type 3 Driver (Net Protocol driver):

In Type 3 driver, a three-tier approach is used to accessing databases. The JDBC clients use standard network sockets to communicate with a middleware application server. The socket information is then translated by the middleware application server into the call format required by the DBMS, and forwarded to the database server. This kind of driver is extremely flexible, since it requires no code installed on the client and a single driver can actually provide access to multiple databases.
You can think of the application server as a JDBC “proxy,” meaning that it makes calls for the client application. As a result, you need some knowledge of the application server’s configuration in order to effectively use this driver type.Your application server might use a Type 1, 2, or 4 driver to communicate with the database, understanding the nuances will prove helpful.

  • • Serves as a pure java driver and are auto downloadable.
  • • Does not require native libraries on the client machine.
  • • Allows a single driver to access multiple databases.
  • • Configures the database details in the middleware server, instead of providing these details to the client.
  • • Follows 3-tier architecture hence it allows to access the database between the networks and manage the database resources accurately.
  • • Provides slow communication due to the increased number of network calls.
  • • Too cost as compared to other drivers.
Type-4-Driver (Thin driver / fully java driver):

In Type 4 driver, a pure Java-based driver that communicates directly with vendor’s database through socket connection. This is the highest performance driver available for the database and is usually provided by the vendor itself.
This kind of driver is extremely flexible; you don’t need to install special software on the client or server. Further, these drivers can be downloaded dynamically.


MySQL’s Connector driver is a Type 4 driver. Because of the proprietary nature of their network protocols, database vendors usually supply type 4 drivers.

  • • Serves as a pure java driver and auto downloadable.
  • • Does not require native libraries to be installed on the client machine.
  • • Uses the database server specific protocol and thereby it is secure to use this driver.
  • • Does not require a middleware server.
  • • It uses database specific proprietary protocol and is DBMS vendor dependent.
Thin Driver for Oracle Corporation:
  • • If you are accessing one type of database, such as Oracle, Sybase, or IBM, the preferred driver type is 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.

About the Author

Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc