JDBC Components

683 views
optmiize_your_resume_1

 The components of the JDBC API are as follows :

Driver

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.

Driver Manager

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.


Connection Interface

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 Statements

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.

ResultSets

ResultSet is an interface to represent a database table.

JDBC Components
  • 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

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.

20%off for Ink 280 281

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More