Table of Contents
The components of the JDBC API are as follows :
A JDBC driver is a software component(or collection of Java classes) enabling a Java application to interact with a database. For instance, MySQL will have its own JDBC driver. A JDBC driver implements a lot of the JDBC interfaces. When your code uses a given JDBC driver, it actually just uses the standard JDBC interfaces. The concrete JDBC driver used is hidden behind the JDBC interfaces. Thus you can plug in a new JDBC driver without your code noticing it.
- The driver handles the communication with the database server (like Oracle, MySQL).
- You will interact directly with the Driver object very rarely.
- Instead, you use Driver Manager objects, which manages objects, which manages objects of this type.
- It also abstracts the details associated with the working of Driver Objects.
It manages a list of database drivers .
- It matches connection request from the java application with the proper database driver using communication sub-protocol.
- The first driver that recognize a certain sub-protocol under JDBC will be used to established a database connection.
It has all the method for contacting a database .
- The connection object represents communication context. i.e all communication with the database is through connection object only.
Prepared Statement is an interface for representing SQL statements.
- A SQL statement is precompiled and stored in a PreparedStatement object.
- This Object can then be used to efficiently execute this statement multiple times.
ResultSet is an interface to represent a database table.
- These objects hold data retrieved from a database after you execute an SQL query using Statement Objects.
- It acts as an interface that allows you to move through its database.
SQLException is a sub-class of Exception class in Java.
- It is an exception that provides information on a database access error or other errors.