Java Database Connectivity (JDBC) Introduction -


JDBC is an application programming interface (API) that provides connectivity with the database and executes queries. JDBC API makes use of JDBC drivers to connect with the database.



Types of JDBC Drivers -

Java has 4 types of JDBC drivers that you can use to connect with the databases -

1- Type 1 Driver (JDBC-ODBC Bridge Driver) -
It makes use of ODBC driver to work with the database. JDBC-ODBC Driver converts JDBC methods call into ODBC function calls. And ODBC drivers are written in C language, so they are platform dependent. Also ODBC drivers are slower than other type of drivers available and must be installed and configured on each user's machine.



2- Type 2 Driver (Native API Driver) -
It is a partially java driver. It makes use of java classes in conjunction with native driver that is not written in java. So it is platform specific. These drivers are faster than Type 1 drivers but they also need to install on every client machine.



3- Type 3 Driver (Network Protocol Driver) - It is a pure java driver. It provides connection with the middleware component (web server for example) using generic network protocol and The middleware component have to use any other type of driver to provide the actual database access.



4- Type 4 Driver (Native Protocol Driver or Thin Driver) - It is a pure java driver that provides direct access to the database without requiring any additional software.

In our programs we will use type 4 driver.