JDBC Driver is a software component that enables java application to interact with the database.There are 4 types of JDBC drivers:
1)JDBC-ODBC bridge driver
2)Native-API driver (partially java driver)
3)Network Protocol driver (fully java driver)
4)Thin driver (fully java driver)
1) JDBC-ODBC bridge driver
A type 1 JDBC driver consists of a Java part that translates the JDBC interface calls to ODBC calls. An ODBC bridge then calls the ODBC driver of the given database. Type 1 JDBC Drivers provide the bridge between JDBC and ODBC API and hence the name ‘JDBC-ODBC Bridge Drivers’. This type of drivers translate all JDBC calls into ODBC calls and sends them to ODBC driver which interacts with the database. These types of drivers are slowest of all types. Because, all JDBC calls will go to the ODBC driver through the bridge and then to database.
2) Native-API driver (partially java driver)
Type 2 JDBC Driver translates all JDBC method calls into database specific calls using native API of the database. Its performance is slightly better than the Type 1 driver as communication layer is reduced in this driver. But, like Type 1 Driver, it is also not entirely written in java language. This causes the portability issues. And also this driver is database specific.
3) Network Protocol driver (fully java driver)
Type 3 JDBC Drivers make use of middle ware or application server that translates all JDBC calls into database specific calls. One of the main advantage of this driver is that it is entirely written in java language. So no portability issues. But it is costly as extra application server or middle ware component has to be maintained.
4) Thin driver (fully java driver)
Type 4 JDBC Driver is also called Thin Driver as it directly converts JDBC calls into database specific calls. This driver is most popular among all 4 type of JDBC drivers. This driver is preferred over Type 3 Driver as it removes extra layer of communication (Application Server / Middle ware) and this makes it faster than the Type 3 JDBC Driver. A type 4 JDBC driver is an all Java driver which connects directly to the database. It is implemented for a specific database product. Today, most JDBC drivers are type 4 drivers.