Java Database Connectivity

A JDBC-to-ODBC bridge enables connections to any ODBC-accessible data source in the Java virtual machine (JVM) host environment.Sun Microsystems released JDBC as part of Java Development Kit (JDK) 1.1 on February 19, 1997.

[2] JDBC 4.1, is specified by a maintenance release 1 of JSR 221[3] and is included in Java SE 7.

[4] JDBC 4.2, is specified by a maintenance release 2 of JSR 221[5] and is included in Java SE 8.

[6] The latest version, JDBC 4.3, is specified by a maintenance release 3 of JSR 221[7] and is included in Java SE 9.

The API provides a mechanism for dynamically loading the correct Java packages and registering them with the JDBC Driver Manager (DriverManager).

Note that Connections, Statements, and ResultSets often tie up operating system resources such as sockets or file descriptors.

It is vital to close() any JDBC object as soon as it has played its part; garbage collection should not be relied upon.

The following code is an example of a PreparedStatement query which uses conn and class from the first example: If a database operation fails, JDBC raises an SQLException.

It is recommended that the SQLException be translated into an application domain exception (an unchecked one) that eventually results in a transaction rollback and a notification to the user.

JDBC drivers are client-side adapters (installed on the client machine, not on the server) that convert requests from Java programs to a protocol that the DBMS can understand.