Home > Uncategorized > An Introduction to JDBC for Java Developers

An Introduction to JDBC for Java Developers

JDBC stands for Java Database Connectivity which is there to establish connection between Java and a Relational Database System.

JDBC – a conceptual model or an API?

JDBC is an integrated package or an API of Java Classes, interfaces and exceptions and a specification for Java vendors and Java Developers to execute the programs. Moreover, JDBC is a well known data retrieval standard made more specifically for RDBMS. It consists of different built-in drivers to get connected to database. For example, to access and retrieve data from MySQL JDBC uses ConnectorJ driver of JDBC.

Java developers working of JDBC application can move from one application to another just by replacing the driver and without requiring rewriting whole application again. This functionality saves the most of the efforts of Java developers which are not worth and yet time consuming.

JDBC specification and background:

From the born, the JDBC specification is prepared and maintained by SUN. Java Developers and Vendors then uses this specification according to their needs to access the data.

JDBC is the only thing which lead Java Developers to develop data communication applications without learning wide range of API from the different RDBMS sources.

JDBC Architecture
JDBC Architecture is divided into 2 parts:
•    JDBC API (java.sql & javax.sql packages)
•    JDBC Driver Types

JDBC API

The JDBC API is available in the java.sql and javax.sql packages. Following are important JDBC classes, interfaces and exceptions in the java.sql package:

DriverManager – Loads JDBC drivers in memory. Can also be used to open connections to a data source.

Connection – Represents a connection with a data source. Is also used for creating Statement, PreparedStatement and CallableStatement objects.

Statement – Represents a static SQL statement. Can be used to retrieve ResultSet object/s.
PreparedStatement – Higher performance alternative to Statement object, represents a precompiled SQL statement.

CallableStatement – Represents a stored procedure. Can be used to execute stored procedures in a RDBMS which supports them.

ResultSet – Represents a database result set generated by using a SELECT SQL statement.

SQLException – An exception class which encapsulates database base access errors.

Advertisements
Categories: Uncategorized Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: