Introduction of JDBC

JDBC

JDBC stands for Java DataBase Connectivity, which is java API to connect and execute query with the database.

Advantages of using java with JDBC are as follows
 Easy & economical
 Development time of application is short
 Installation is simple

JDBC API
JDBC API is designed to allow developers to create database frontend without rewriting their code
JDBC API actually communicates with JDBC manager driver API by sending SQL statements
The manager then communicates with the 3rd – party drivers which actually connect to the database & return the information of a query

JDBC API is available in 2 packages
 java.sql
 javax.sql

java.sql package

 Driver Manager
It is a class used to load JDBC drivers in memory. It is also used to open connection to a data source
 Connection
It represents a connection with a data source. It is also used by createStatement, prepareStatement & callableStatement objects
 Statement
It represents a static SQL statement & it is also used to retrieve rows from a database table i.e. ResultSet object
 PreparedStatement
It is a high performance alternative to statement object. It represents a pre-compiled SQL statement.
 CallableStatement
It represents a stored procedure.
 ResultSet
It represents a result set which is generated by SELECT SQL statement
 SQLException
It is an exception class which encapsulates data base access error

javax.sql package

 DataSource
It abstracts a data source. This object is used in place of Driver Manager to obtain the data source connection.
 XADataSource, XAConnection
It allows the support for distributed transaction
 RowSet
It extends ResultSet interface to add support for disconnected result set

Leave a Reply

Your email address will not be published. Required fields are marked *