Comentários (1)

1 JoAnnB comentou às Link permanente

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(); }
}