24.3. The JDBC Package

The JDBC library was designed as an interface for executing SQL statements, and not as a high-level abstraction layer for data access. So, although it wasn't designed to automatically map Java classes to rows in a database, it allows large-scale applications to be written to the JDBC interface without worrying too much about which database will be deployed with the application. A JDBC application is well insulated from the particular characteristics of the database system being used and therefore doesn't have to be re-engineered for specific databases. From the user's point of view, a Java application working with a database looks conceptually as shown in Figure 24-5.

Figure 24.5. Figure 24-5

JDBC manages to operate with a variety of different relational database systems by having an implementation of the JDBC interface for each specific database—a driver. This handles the mapping of Java method calls in the JDBC classes to the database API. You'll learn more about this later on.

24.3.1. Relating JDBC to ODBC

One of the fundamental principles of JDBC's design was to make it practical to build JDBC drivers based on other database APIs. There is a very close mapping between the JDBC architecture and API and the Open DataBase Connectivity (ODBC) counterparts, fundamentally because they are all based on the same standard, the SQL X/Open CLI; but JDBC is a ...

Get Ivor Horton's Beginning Java™ 2, JDK™ 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.