What is JDBC?

JDBC stands for Java Database Connectivity. It is a Java library/specification released by sun microsystems. It enables Java applications to communicate with databases.

A JDBC driver is an implementation of the above-mentioned specification i.e. it contains the classes and interfaces to communicate with the database. Using JDBC driver and JDBC API you can write Java applications which will send a request to the database and retrieve the results.

I.e. you can connect to the database, create SQL statements, Execute the SQL statements, access and modify the resultant tables using this library.

Fundamentally, JDBC is a specification that provides a complete set of interfaces that allows for portable access to an underlying database. Java can be used to write different types of executables, such as −

  • Java Applications

  • Java Applets

  • Java Servlets

  • Java ServerPages (JSPs)

  • Enterprise JavaBeans (EJBs).

All of these different executables are able to use a JDBC driver to access a database, and take advantage of the stored data. JDBC provides the same capabilities as ODBC, allowing Java programs to contain database-independent code.