Java Database Connectivity (JDBC) drivers are software components that are essentially client-side adapters, installed on the client’s device. It enables the Java program to interact with the database, by converting the program’s requests into a protocol that can be understood by the database management system (DBMS). There are 4 types of such drivers:
- JDBC-ODBC bridge driver
- Native API driver
- Network protocol driver
- Thin driver
JDBC-ODBC bridge driver
This type of driver uses the Open Database Connectivity (ODBC) driver to connect to the database. This is also referred to as the ‘Universal driver’ as it can be used to connect to any database. It converts JDBC method calls to ODBC function calls, thus an ODBC driver needs to be preinstalled on the client’s device. Since this is a single common driver used for interacting with various databases, it is not a very secure option. This driver software comes built-in the JDK and does not require separate installation. It is a database independent driver that is not written in Java. Due to this, the JDBC-ODBC driver is not portable.
Native API driver
This driver uses the client-side libraries and it converts JDBC method calls to native calls for the database API. Here the data transfer is much more secure as compared to the JDBC-ODBC bridge driver as every native API driver needs its local API. Unlike the JDBC-ODBC bridge driver, this driver needs separate installation on the client’s device along with installation of the vendor client library. This driver is not entirely written in Java hence it is not portable. The native API driver is a database dependent driver.
Network protocol driver
Unlike its predecessors, the Network protocol driver uses a middleware (application server). The function of this middleware is to convert JDBC calls, directly or indirectly to vendor specific database protocol. No individual client-side installation is required as all the database connectivity drivers are present in a single server, much to the user’s convenience. A major advantage that the Network protocol driver has over the previous two drivers is it is fully written in Java. This makes the driver portable unlike the other two. The application server itself can perform many tasks like auditing, logging etc, and there is no need for separate client-side libraries. There is a switch facility that enables the user to switch between two libraries. While there are very many advantages of the Network protocol driver, the maintenance of this type of driver becomes cost intensive as it requires database specific coding in the middle tier. Also, the Network protocol driver requires network support.
This driver is also referred to as the ‘Native Protocol Driver’ as it directly converts the JDBC calls to vendor specific database protocol that lets it directly interact with the database without requiring any native database library. This is why it is known as the ‘Thin Driver’. No separate middleware server or client-side server needs to be installed. Just like the Network Protocol Driver, thin driver too is fully written in Java which makes it portable. Although the driver depends on the database, this driver has a better performance in comparison to all the other aforementioned drivers.