Advertisement



< Prev
Next >



Types of JDBC drivers



A Java application that wishes to communicate with any specific database uses JDBC Application Programming Interface(API). JDBC API is set of methods and classes using which a Java application communicates with a JDBC driver, which in turn communicates directly with a specific database.

For example- A Java Application wishing to stores its data with MariaDB database, should use JDBC API, which will directly act as an interface between Java application and MariaDB database. This JDBC API will communicate with a vendor specific - JDBC MariaDB Driver, which will directly communicate with MariaDB dabatase. Accessing this specific JDBC driver using JDBC API allows this Java application to store, query or retrieve its data in MariaDB database.

This JDBC API interacts with a database vendor specific JDBC driver, which communicates directly with the database.

Types of JDBC drivers There are over 200 different kinds of JDBC drivers available which are broadly categorized into four types. Let's know a little bit about each of these four types of JDBC Drivers.


JDBC-ODBC Bridge Driver / Type-1 Driver

Some databases provide an ODBC driver to allow applications to connect to their databases, where ODBC stands for Open Database Connectivity. A Java Application wishing to communicate with a database that has an ODBC driver, will use JDBC API to communicate with a JDBC-ODBC Bridge Driver. This JDBC-ODBC Bridge Driver will directly communicate with a particular ODBC driver, which further directly communicates with its specific database.

Advantage of JDBC-ODBC Bridge Driver
Using the JDBC-ODBC Bridge Driver, a Java application can easily communicate with a database that has provided an ODBC driver.

Disdvantage of JDBC-ODBC Bridge Driver
Java application is dependent on ODBC driver for communicating with database.





Native - API Partly Java Driver / Type-2 Driver

Some database vendors only provide native APIs to access their database. These native APIs are written in C/C++ or Assembly Language. When a Java application wants to communicate or stores its data in a database that only provides Native APIs, then it must use Native - API Partly Java Driver.


How a Java application connects to a database through a Native - API Partly Java Driver .

Note: An example of a database using a Native - API Parly Java Driver is WebLogic - OCI Driver.


Advantage of JDBC-ODBC Bridge Driver
In the absence of JDBC-ODBC bridge, this driver is faster than Type-1 driver.

Disadvantage of JDBC-ODBC Bridge Driver
Using this driver requires database specific native Library APIs to be stored on the client-side because it is used to translate JDBC calls to database specific calls to communicate with a database.


Advertisement




Pure Java Driver for Database Middleware / Type-3 Driver

This type of JDBC driver converts the JDBC calls made by a Java Application at a client-side to a Middleware Server specific network calls. At Middleware Server, the server specific calls are received and converted to a database specific calls and the specific database is communicated.

Note : Network calls made by Type-3 driver from client-side to middleware server are database independent, hence a single JDBC Type-3 driver at client-side can be used to access multiple databases.

This driver is fully written in Java and it is mainly used for connecting applets with databases. An example of a Pure Java Driver for Database Middleware is Weblogic RMI Driver.

Advantage of JDBC-ODBC Bridge Driver

Please Subscribe

Please subscribe to our social media channels for daily updates.


Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page




Advertisement



Notifications



Please check our latest addition

C#, PYTHON and DJANGO


Advertisement