Does any one know of a foolproof way to close a connection? A standard perhaps?
To avoid this msg:
DriverManagerConnectionPoolConnection not closed, check your code!
I have one suggestion but I'm not sure that it is correct.
Connection conn = null;
Statement stmt = null;
try {
conn = DB.getConnection();
stmt = conn.createStatement();
stmt.executeUpdate("delete from user where userid= "+userid);
}catch (SQLException eExc) { eExc.printStackTrace();}
finally {
try {
stmt.close();
conn.close();
}catch(SQLException sqlExc){exOcc = true; sqlExc.printStackTrace();}
}