Câu hỏi phỏng vấn Java
Câu hỏi

What is JDBC?

Câu trả lời

Java Database Connectivity (JDBC) is an application programming interface (API) for the Java programming language that defines how a client may access a database. It provides methods for querying and updating data in a database, and is oriented toward relational databases. JDBC is part of the Java Standard Edition platform from Oracle Corporation[5].

JDBC allows Java applications to interact with any SQL-compliant database by using a set of standard interfaces. The API provides functionality for connecting to a database, executing SQL statements, and retrieving results. These operations are carried out through what JDBC terms as "connections," "statements," and "result sets."[2][4].

The core component of JDBC is the JDBC API, which includes two packages: java.sql and javax.sql. These packages contain classes and interfaces that Java applications use to interact with databases. The java.sql package includes interfaces like Connection, Statement, PreparedStatement, ResultSet, and others that handle the connection to the database and the execution of SQL statements. The javax.sql package extends the functionality of java.sql to include features such as connection pooling and distributed transactions[2][4][16].

JDBC drivers are crucial for connecting to a database. These drivers are categorized into four types:

  1. Type 1: JDBC-ODBC bridge driver that converts JDBC calls into ODBC calls. This type is generally used for testing and prototyping or when no other driver is available.
  2. Type 2: Native-API driver that converts JDBC calls into database-specific calls.
  3. Type 3: Network-Protocol driver (middleware driver) that converts JDBC calls into a database-independent net protocol which is then translated to a database pr...
junior

junior

Gợi ý câu hỏi phỏng vấn

middle

What’s the difference between a ClassNotFoundException and NoClassDefFoundError ?

senior

Does Java support default parameter values?

entry

What is JVM? Why is Java called the "Platform Independent Programming Language"?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào