JDBC - Database Connectivity
Difficulty: medium
Overview
JDBC workflow: load driver → DriverManager.getConnection() → createStatement()/prepareStatement() → executeQuery()/executeUpdate() → process ResultSet → close resources. PreparedStatement prevents SQL injection and caches execution plans for repeated use. ResultSet cursor moves forward-only by default. Four driver types: Type 1 (ODBC bridge), Type 2 (native-API), Type 3 (network protocol), Type 4 (thin/pure Java). Connection pooling reuses connections for performance.
Practice Linked Questions
Q1. JDBC stands for:
Select one answer before revealing.
Q2. Why is PreparedStatement preferred over Statement in JDBC?
Select one answer before revealing.
Q3. Connection pooling in JDBC provides which primary benefit?
Select one answer before revealing.
Q4. Which of the following are valid JDBC driver types? (More than one answer may be correct)
Select one answer before revealing.
Q5. By default, a ResultSet cursor in JDBC moves:
Select one answer before revealing.