For a code similar to this,
try{
Connection con =....
Statement stmt = ....
ResultSet set = ...
}
catch(Exception e){
...
}
finally {
con.close();
}
Given that the connection goes to a connection pool:
When con.close()
is called, it goes to the connection pool and remains active. At one point of time, these connections get closed right? In that case, do we need to close result set and stmt objects as the connection will eventually get closed?
Also, can there be a situation where the stmt/result set objects might still be used and causing the connection in connection pool not getting closed?