JDBC Overview & Architecture

JDBC Overview & Architecture

  • JDBC stands for Java Database Connectivity. 
  • JDBC is a Java API to connect and execute CRUD operations with the database. 
  • It is a part of JavaSE
  • JavaSE stands for Java Standard Edition.
  • JDBC API uses JDBC drivers to connect with the database. 
  • It is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.

  • 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.
  • JDBC Architecture:
  • There are two types:
    • 2 Tier
    • 3 Tier


What is API?

  • API stands for Application programming interface.
  • It is a document that contains a description of all the features of a software. 
  • It represents classes and interfaces.
  • It is used to communicate with each other
  • An API can be created for applications, libraries, operating systems, etc.
  • The JDBC API supports both two-tier and three-tier processing models for database access but in general, JDBC Architecture consists of two layers −
    • JDBC API: This provides the application-to-JDBC Manager connection.
    • JDBC Driver API: This supports the JDBC Manager-to-Driver Connection.
  • The JDBC API provides the following interfaces and classes −
    • DriverManager
      • This class manages a list of database drivers. 
      • Matches connection requests from the java application with the proper database driver.
    • Driver
      • This interface handles the communications with the database server. 
      • You will interact directly with Driver objects very rarely. 
    • Connection
      • This interface with all methods for contacting a database. 
      • The connection object represents communication context, i.e., all communication with the database is through connection object only.
    • Statement
      • You use objects created from this interface to submit the SQL statements to the database. 
    • ResultSet
      • These objects hold data retrieved from a database after you execute an SQL query using Statement objects. 
      • It acts as an iterator to allow you to move through its data.
    • SQLException
      • This class handles any errors that occur in a database application.
  • The JDBC library includes APIs for each of the tasks mentioned below that are commonly associated with database usage.
    • Making a connection to a database.
    • Creating SQL or MySQL or Oracle statements.
    • Executing SQL or MySQL or Oracle queries in the database.
    • Viewing & Modifying the resulting records.
  • 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 executable, such as −
    • Java Applications
    • Java Applets
    • Java Servlets
    • Java Server Pages (JSPs)
    • Enterprise Java Beans (EJBs).




Thanks a lot for query or your valuable suggestions related to the topic.

Previous Post Next Post

Contact Form