Entrance Exams
Govt. Exams
PreparedStatement allows parameterized queries using placeholders (?) and prevents SQL injection attacks.
Statement interface is used to execute SQL queries. Connection creates statements, ResultSet holds results, and Driver manages connections.
JDBC Connections are not thread-safe. Each thread must have its own Connection to prevent concurrent access issues and data corruption.
Try-with-resources (try-with-resources statement) automatically closes AutoCloseable resources, preventing memory leaks.
Closing a Statement typically invalidates its associated ResultSet in most JDBC drivers, though behavior may vary.
Unclosed connections remain allocated, eventually exhausting the connection pool and causing application failures.
CallableStatement is used to call stored procedures and stored functions in the database.
Connection pooling maintains a pool of reusable connections, reducing the cost of creating new connections repeatedly.
CONCUR_READ_ONLY is the concurrency constant that specifies a read-only ResultSet.
ResultSetMetaData provides information about columns, data types, and column properties of a ResultSet.