java tutorial - JDBC in java - java programming - learn java - java basics - java for beginners
- The Java Database Connectivity driver (JDBC driver) is a little part of software which allows JDBC to connect with different databases. It is a software component which enables java application to interact with database. There are four types of JDBC drivers. They are,
- JDBC-ODBC bridge driver
- Native-API driver (partially java driver)
- Network Protocol driver (fully java driver)
- Thin driver (fully java driver)
JDBC-ODBC bridge driver
- JDBC bridge is used to access ODBC drivers installed on each client machine.
- The ODBC requires configuring on your system a Data Source Name (DSN) which represents a 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.
Learn java - java tutorial - JDBC-ODBC bridge driver - java examples - java programs
Advantages:
- Simple to use.
- Simple to Database connection.
- Almost several databases for which an ODBC driver is installed can be accessed, and then data can be retrieved.
Disadvantages:
- Processing overhead is increased.
- Since it uses ODBC driver in the middle, there is no use of JDBC interface.
- This driver does not support Java commands.
- Performance degraded because JDBC method call is converted into the ODBC function calls.
- An ODBC driver wants to install in the client machine.
Native-API driver
- The Native-API driver uses client-side libraries of a database.
- The driver converts JDBC method calls into native calls of the database API. It is not written completely in java.
Learn java - java tutorial - Native-API driver - java examples - java programs
Advantage:
- It performance is better than JDBC-ODBC bridge driver.
Disadvantage:
- The Native driver needs to be installed on the each client machine.
- The Vendor client library needs to be installed on client machine.
Network Protocol driver
- The Network Protocol driver uses middleware (application server) which converts JDBC calls directly or indirectly into the vendor-specific database protocol. It is entirely written in java.
Learn java - java tutorial - Network Protocol driver - java examples - java programs
Advantage:
- Network Protocol driver is portable and works with any database.
- No client side library is required because application server which can perform lots of tasks like auditing, load balancing, logging and so on.
Disadvantage
- Network support is required on client machine.
- It requires database-specific coding can be done in middle tier.
- Maintenance of Network Protocol driver becomes expensive. Why means, it requires database-specific coding to be done in the middle tier.
Thin driver
- Thin driver converts JDBC calls directly into the vendor-specific database protocol. It is entirely written in Java language.
Learn java - java tutorial - Thin driver - java examples - java programs
Advantage:
- Compare to all drivers thin driver is better for others.
- No software is required at client side or server side.
Disadvantage:
- Drivers depends on the Database.