Java Reference
In-Depth Information
SQL is the industry-standard approach to accessing relational databases. JDBC supports
SQL, enabling developers to use a wide range of database formats without knowing the
specifics of the underlying database. JDBC also supports the use of database queries spe-
cific to a database format.
The JDBC class library's approach to accessing databases with SQL is comparable to
existing database-development techniques, so interacting with an SQL database by using
JDBC isn't much different than using traditional database tools. Java programmers who
already have some database experience can hit the ground running with JDBC.
The JDBC library includes classes for each of the tasks commonly associated with data-
base usage:
Making a connection to a database
n
Creating a statement using SQL
n
Executing that SQL query in the database
n
Viewing the resulting records
n
These JDBC classes are all part of the java.sql package.
Database Drivers
Java programs that use JDBC classes can follow the familiar programming model of
issuing SQL statements and processing the resulting data. The format of the database and
the platform it was prepared on don't matter.
18
This platform- and database independence is made possible by a driver manager. The
classes of the JDBC class library are largely dependent on driver managers, which keep
track of the drivers required to access database records. You'll need a different driver for
each database format that's used in a program, and sometimes you might need several
drivers for versions of the same format. Java DB includes its own driver.
JDBC also includes a driver that bridges JDBC and another database-connectivity stan-
dard, ODBC.
The JDBC-ODBC Bridge
ODBC, Microsoft's common interface for accessing SQL databases, is managed on a
Windows system by the ODBC Data Source Administrator.
This is run from Control Panel on a Windows system; to get there on most versions of
Windows, click Start, Settings, Control Panel, ODBC Data Sources. On Windows XP,
choose Start, Control Panel, Performance and Maintenance in Category View or Start,
Control Panel in Classic View and then choose Administrative Tools, Data Sources
(ODBC).
 
Search WWH ::




Custom Search