Java Reference
In-Depth Information
JDBC 1.0 API Compliance, which requires implementation of the following interfaces:
java.sql.Driver
java.sql.DatabaseMetaData (excluding those portions defined in the JDBC 2.0 and 3.0
extensions)
java.sql.ResultSetMetaData (excluding portions defined in the JDBC 2.0 and 3.0
extensions)
java.sql.Connection
java.sql.Statement
java.sql.CallableStatement
java.sql.PreparedStatement
java.sql.ResultSet
JDBC 2.0 API Compliance, which requires:
JDBC 1.0 API Compliance
Full implementation of the DatabaseMetaData interface extensions defined in JDBC 2.0
Implementation of additional JDBC 2.0 ResultSet methods
JDBC 3.0 API Compliance, which requires:
JDBC 2.0 API Compliance
Implementation of java.sql.ParameterMetaData
Implementation of java.sql.Savepoint
Full implementation of the DatabaseMetaData interface extensions defined in JDBC 3.0
Driver developers can ascertain that their drivers meet the JDBC Compliance
standards by using the test suite available with the JDBC API.
Having discussed how variations in SQL implementations, and variations in JDBC
compliance are handled, it is time to move on to the actual workings of the JDBC API.
The
next section
discusses how JBC actually works.
How Does JDBC Work?
The key interfaces in the JDBC Core API are as follows:
java.sql.DriverManager. In addition to loading JDBC drivers, the DriverManager is responsible
for returning a connection to the appropriate driver. When getConnection() is called, the
DriverManager attempts to locate a suitable driver for the URL provided in the call by polling the
registered drivers.
java.sql.Driver. The Driver object implements the acceptsURL(String url)method, confirming its
ability to connect to the URL the DriverManager passes.
java.sql.Connection. The Connection object provides the connection between the JDBC API and
the database management system the URL specifies. A Connection represents a session with a
specific database.
java.sql.Statement. The Statement object acts as a container for executing a SQL statement on
a given Connection.