JDBC

JDBC is a Java API for executing SQL statements1. It consists of a set of classes and interfaces written in Java. Although JDBC resembles Microsoft Corporation's Open Database Connectivity (ODBC) API, JDBC provides a more natural Java interface. It does, however, build on ODBC, so people familiar with ODBC will find it easy to use JDBC. Both JDBC and ODBC are based on the X/Open SQL CLI (Call Level Interface).

Using JDBC, SQL statements can be sent to virtually any database management system (DBMS). It is used as an interface for both relational and object DBMSs.

JDBC uses the call-level approach when using the Java programming language. This is illustrated by the JDBC statements in this diagram.

JDBC

An example of a JDBC statement that creates a new Person instance would be:

PreparedStatement insertPerson = con.prepareStatement(
                "INSERT INTO PERSON " +
                 "VALUES (?,?)");

insertPerson.setString(1, "999999999");
insertPerson.setString(2, "Doug Barry");
insertPerson.executeUpdate();

If you also wanted to manipulate this new Person instance in the host program, you would need Java code in addition to this code fragment that populates the instance in Java along with the instance in the database. Also see

>>
For an architectural example of how JDBC can be used, see

1. JDBC is a trademarked name and is not an acronym. JDBC, however, is often mistakenly thought to stand for "Java Database Connectivity."

Current Article Context

Related Articles

The Savvy Manager's Guide

is also the author of a book that explains Web Services, service-oriented architecture, and Cloud Computing in an easy-to-understand, non-technical manner.

Web Services, Service-Oriented Architectures, and Cloud Computing: The Savvy Manager's Guide

by with David Dick

This is a guide for the savvy manager who wants to capitalize on the wave of change that is occurring with Web Services, service-oriented architecture, and—more recently—Cloud Computing. The changes wrought by these technologies will require both a basic grasp of the technologies and an effective way to deal with how these changes will affect the people who build and use the systems in our organizations. This book covers both issues. Managers at all levels of all organizations must be aware of both the changes that we are now seeing and ways to deal with issues created by those changes.