1.

Introduction to JDBC:

Answer»

JDBC is an Application Programming Interface(API) for Java, which is helpful for interaction with the database and for EXECUTING the SQL query. JDBC is an abbreviation used for Java Database Connectivity. It uses JDBC drivers for connecting with the database. JDBC API is used to access tabular data stored in relational databases like Oracle, MySQL, MS Access, etc.

Components of JDBC:

There are four major components of JDBC using which it can interact with a database. They are:

  1. JDBC API: It provides different methods and interfaces for easier COMMUNICATION with the database. By using this, applications are able to execute SQL statements, retrieve results and make updation to the database. It has two packages as follows which consist of Java SE and Java EE platforms to exhibit Write Once Run Everywhere(WORA) capabilities.
    1. java.sql.*;
    2. javax.sql.*;
      Also, it provides a standard for connecting a database to a client application.
  2. JDBC DriverManager: It is the class in JDBC API. It loads the JDBC driver in a Java application for establishing a CONNECTION with the database. It is useful in MAKING a database-specific call for processing the user request.
  3. JDBC Test suite: It is used to test the operations like insertion, deletion, updation etc., being performed by JDBC Drivers.
  4. JDBC-ODBC bridge drivers: It will connect database drivers to the database. JDBC-ODBC bridge interprets JDBC method call to the ODBC function call. It will use sun.jdbc.odbc package, which consists of the native library to access characteristics of ODBC.
Scope of JDBC:

Earlier, ODBC API was used as the database API to connect with the database and execute the queries. But, ODBC API uses C language for ODBC drivers(i.e. platform-dependent and unsecured). Hence, Java has defined its own JDBC API that uses JDBC drivers, which offers a natural Java interface for communicating with the database through SQL. JDBC is required to provide a “pure Java” SOLUTION for the development of an application using Java programming.



Discussion

No Comment Found

Related InterviewSolutions