Driver:
A driver is a software component that provides the facility to a computer to communicate with hardware.
JDBC driver:
A driver is a software component that provides the facility to interact java application with the database.
Types of JDBC drivers:
- JDBC-ODBC bridge driver.
- Native-API driver.
- Network-Protocol driver.
- Thin driver.
1. JDBC-ODBC bridge driver:
JDBC-ODBC bridge driver is a native code driver which uses ODBC driver to connect with the database. It converts JDBC method calls into ODBC function calls. It is also known as Type 1 driver.
Advantages:
- It can be used with any database for which an ODBC driver is installed.
Disadvantages:
- Performance is not good as it converts JDBC method calls into ODBC function calls.
- ODBC driver needs to be installed on the client machine.
- Platform dependent.
2. Native-API driver:
Native-API driver uses the client-side libraries of the database. It converts JDBC method calls into native calls of the database API. It is partially written in java. It is also known as Type 2 driver.
Advantages:
- It is faster than a JDBC-ODBC bridge driver.
Disadvantages:
- Platform dependent.
- The vendor client library needs to be installed on the client machine.
3. Network-Protocol driver:
Network-Protocol driver is a pure java driver which uses a middle-tier to converts JDBC calls directly or indirectly into database specific calls. Multiple types of databases can be accessed at the same time. It is a platform independent driver. It is also known as Type 3 or MiddleWare driver.
Advantages:
- Platform independent.
- Faster from Type1 and Type2 drivers.
- It follows a three tier communication approach.
- Multiple types of databases can be accessed at the same time.
Disadvantages:
- It requires database-specific coding to be done in the middle tier.
4. Thin driver:
Thin driver is a pure java driver which converts JDBC calls directly into the database specific calls. It is a platform independent driver. It is also known as Type 4 or Database-Protocol driver.
Advantages:
- Platform independent.
- Faster than all other drivers.
Disadvantages:
- It is database dependent.
- Multiple types of databases can’t be accessed at the same time.
Next Topic: Connect to Oracle database with JDBC driver.
Previous Topic: JDBC overview.