Database Java Tutorial

You may improve database performance by including the ResultSet holdability:
java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT
java.sql.ResultSet.CLOSE_CURSORS_AT_COMMIT
Set ResultSet Holdability Using the Connection Object

int holdability = java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;
conn.setHoldability(holdability);
Or

int holdability = java.sql.ResultSet.CLOSE_CURSORS_AT_COMMIT;
conn.setHoldability(holdability);