Components of JDBC

Below are the Components of JDBC -

  • JDBC API
  • JDBC Dri­ver Man­ag­er
  • JDBC Test Suite
  • JDBC Dri­ver

JDBC API -

The JDBC API pro­vides pro­gram­mat­ic access to rela­tion­al data from the Java Pro­gram­ming Lan­guage. Using the JDB AP, an appli­ca­tion can exe­cute SQL state­ments, retrieve results. JDBC API can also inter­act with mul­ti­ple data bases in a dis­trib­uted, het­ero­ge­neous envi­ron­ment.

The JDBC API is a part of the Java Plat­form, which Includes the Java Stan­dard Edi­tion and the Java Enter­prise Edi­tion.

The JDBC 4.0 API is divid­ed into tow pack­ages : java.sql and javax.sql. Both pack­ages are includ­ed in the Java SE and Java EE plat­form.

JDBC Driver Manager -

The JDBC Dri­ver Man­ag­er class define objects which can con­nect Java appli­ca­tion to a JDBC Dri­ver. In anoth­er word, it man­ages the list of the data­base dri­ver.

In the below-giv­en dia­gram, you can see Java Appli­ca­tion (Left) Dri­ver Man­ag­er (Mid­dle) Data­base (Right) So from Java Appli­ca­tion if you want to con­nect to MySql/​Oracle/​SQL Serv­er data­base then you have to load the data­base spe­cif­ic dri­ver under Dri­ver Man­ag­er.

Load­ing the Dri­ver can be done using below giv­en code.

Class.forName("com.mysql.jdbc.Driver"); MYSQL

Class.forName("com.oracle.jdbc.DriverManager; Oracle

Driver Manager