Java Database Connectivity (JDBC)
What is JDBC
JDBC is the industry-standard API for database-independent
connectivity between the Java applications and Databases, using a SQL
based interface. As with Java itself one of the main features of the JDBC
API is its "Write Once, Run Anywhere" capability enabling
applications to be move from one OS to another without the need for
recompilation. JDBC consists of two key components:
-
JDBC Driver Manager - application
binds to this generic class which is then responsible for loading the
requested JDBC Driver.
-
JDBC Driver -
dynamically loaded by the JDBC Driver manager for making connection to target
Database.
JDBC Drivers are available in four different types ranging from Pure
to Bridge construction:
-
Type 4 - Direct-to-Database Pure
Java Driver using database network protocol for driver communication with
database from Java
-
Type 3 - Pure Java
Driver for Database Middleware using a middleware vendor''s protocol-layer for
connectivity to the Database.
-
Type 2 - A
native API partly Java technology-enabled driver converting JDBC calls into
the Database vendor''s CLI calls for communication with the database.
-
Type 1 - JDBC-ODBC Bridge using an existing ODBC
Driver for connecting to remote databases.
Why use JDBC
JDBC enables maximum interoperability between the application and
database as a single application can access any JDBC-enabled database by
simply being configured to use its JDBC driver, and likewise a JDBC
enabled application can access a given Database using its JDBC driver.
JDBC also has the added advantage of being able to run cross platform with
the need for recompilation, the so-called "Write Once, Run
Anywhere" capability.