JDBC

advertisement
JDBC Introduction
Section 1
What is JDBC

JDBC (Java Database Connectivity) is a
standard Java interface for connecting to
relational databases from Java.

The JDBC standard was defined by Sun
Microsystems, allowing individual
providers to implement and extend the
standard with their own JDBC drivers.

JDBC is based on the X/Open SQL Call
Level Interface, and complies with the
SQL92 Entry Level standard.
JDBC Technology Core Features
Ease of programming - Scrollable result set
ability to move a result set's cursor to a
specific row. This feature is used by GUI
tools and for programmatic updating.
 Updateable result set ability to use Java
programming language commands rather
than SQL.


New data types support performance improvement
(ability to manipulate large objects such as BLOB
and CLOB without bringing them to the client
from the DB server).

Batch updates performance improvement
(sending multiple updates to the DB for
processing as a batch can be much more efficient
than sending update statements separately).
JDBC API

The JDBC API is a Java API for accessing
virtually any kind of tabular data.

The JDBC API consists of a series of
abstract Java interface to address standard
database query requirements: connecting to
a particular databases, executing SQL
statements, and processing the results of the
queries.
JDBC Driver

To use the JDBC API with a particular
database management system, you need a
JDBC technology-based driver to mediate
between JDBC technology and the
database.
What Does JDBC Driver do?
A JDBC technology-based driver ("JDBC
driver") makes it possible to do three things:
Establish
a connection with a data source
Send
queries and update statements to the
data source
Process
the results
Primary JDBC Classes




JDBC consists of an object hierarchy, starting with
the DriverManager class.
From the DriverManager class, you get
Connection objects that point to the particular
database.
From the Connection class, you get Statement
objects that act as containers for a particular SQL
statement execution.
As part of executing a statement, you may get a
ResultSet object that describes that results set you
got back from a particular SQL SELECT.
JDBC Class Relationships
Driver Manager
Connection
Object
Statement
Object
Statement
Object
ResultSet
Object
Connection
Object
Statement
Object
ResultSet
Object
Connection
Object
Statement
Object
ResultSet
Object
Download