Comments (1)
  • Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

1 JoAnnB commented Permalink

Better programming practice would be to put all those closes in a finally block. This avoids connection leaks in DB2 should an exception occur prior to your closes.

 
e.g.
 
...after the catch() {
}
finally {
try { if (null != rs) rs.close();} catch(SQLException se) { se.printStackTrace(); }
try { if (null != stmt) stmt.close();} catch(SQLException se) { se.printStackTrace(); }
try { if (null != con) con.close();} catch(SQLException se) { se.printStackTrace(); }
}