http://www.brentozar.com/archive/2009/09/whats-on-my-bookshelf/
// Open a connection Connection conn = null; Statement st = null; ResultSet rs = null; try { ... conn = DriverManager.getConnection(connStr, uid, pwd); ... st = conn.prepareStatement(sqlString); ... rs = st.executeQuery(); ... } catch (SQLException e){ // exception handling code here } finally { try { if (rs != null) rs.close(); if (st != null) st.close(); if (conn != null) conn.close(); } catch (SQLException e) { // exception handling code here } }













