What is JDBC and what are its main components?

1 Answers
Answered by suresh

Interview Question: What is JDBC and its main components

What is JDBC and its main components

JDBC stands for Java Database Connectivity. It is a Java API that allows Java applications to connect and interact with databases.

Main Components of JDBC

  • Driver: JDBC driver is a set of classes that enables a Java application to connect to a database. There are four types of JDBC drivers: Type 1 (JDBC-ODBC Bridge driver), Type 2 (Native-API driver), Type 3 (Network-Protocol driver), and Type 4 (Thin driver).
  • Connection: This component represents the connection interface to the database. It is used to establish a connection with the database server.
  • Statement: The Statement interface is used to execute SQL queries and update statements. There are three types of statements: Statement, PreparedStatement, and CallableStatement.
  • ResultSet: The ResultSet interface represents the result set of a SQL query. It allows the retrieval and manipulation of data returned by a query execution.

Understanding these main components of JDBC is essential for Java developers working with databases in their applications.

Answer for Question: What is JDBC and what are its main components?