/JDBC - Database Connectivity
Concept
Medium

JDBC - Database Connectivity

1 min read

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 Questions5

easy

Q1. JDBC stands for:


Select one answer before revealing.

medium

Q2. Why is PreparedStatement preferred over Statement in JDBC?


Select one answer before revealing.

hard

Q3. Connection pooling in JDBC provides which primary benefit?


Select one answer before revealing.

medium

Q4. Which of the following are valid JDBC driver types? (More than one answer may be correct)


Select one answer before revealing.

medium

Q5. By default, a ResultSet cursor in JDBC moves:


Select one answer before revealing.