InterviewSolution
Saved Bookmarks
| 1. |
Why do you have to close database connections in Java? |
|
Answer» You need to close the resultset, the statement and the connection. If the connection has come from a pool, closing it actually sends it back to the pool for reuse. We can do this in the finally{} block, such that if an exception is thrown, you still get the chance to close this. |
|