Govt. Exams
Entrance Exams
JdbcTemplate in Spring Framework automatically manages JDBC resources and is the recommended approach in modern applications.
FetchSize controls how many rows are fetched from the database at once, optimizing performance for large datasets.
executeBatch() with addBatch() reduces network round-trips and improves performance for bulk operations.
When rollback() is called without savepoints, all changes made since the last commit are undone and rolled back.
Direct concatenation of user input in SQL queries exposes the application to SQL injection attacks. PreparedStatement should be used instead.
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.
A SavePoint allows you to roll back part of a transaction without rolling back the entire transaction. You can create nested transactions by setting multiple savepoints and rolling back to specific ones.