Chapter 3. Introduction to JDBC

These common thoughts are expressed in a shared public language, consisting of shared signs...a sign has a “sense” that fixes the reference and is “grasped by everybody” who knows the language...

Noam Chomsky, Language and Thought

Database programming has traditionally been a technological Tower of Babel. You are faced with dozens of available database products, and each one talks to your applications in its own private language. If your application needs to talk to a new database engine, you have to teach it (and yourself) a new language. As Java programmers, however, you should not worry about such translation issues. Java is supposed to bring you the ability to “write once, compile once, and run anywhere,” so it should bring it to you with database programming, as well.

SQL was a key first step in simplifying database access. Java’s JDBC API builds on that foundation and provides you with a shared language through which your applications can talk to database engines. Following in the tradition of its other multi-platform APIs, such as the AWT, JDBC provides you with a set of interfaces that create a common point at which database applications and database engines can meet. This chapter will discuss the basic interfaces that JDBC provides.

What Is JDBC?

Working with leaders in the database field, Sun developed a single API for database access—JDBC. As part of this process, they kept three main goals in mind:

  • JDBC should be a SQL-level API.

  • JDBC should ...

Get Database Programming with JDBC & Java, Second 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.