Java / JDBC
List few good practices in JDBC.
Implement connection pooling.
Reuse prepared statement for similar queries so that the DB will reuse the previous query plan for faster performance.
Always close the PreparedStatement when done. With Java 7, use try-with-resources for auto closing.
try (PreparedStatement pstmt = conn.prepareStatement(sqlSt); ResultSet r = pstmt.executeQuery();) { // do some logic with ResultSet }
More Related questions...