This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, If we have a Resultset/Statement open and if we doesnt closed the Resultset/Statement. Rather we make ResultSet/Statement null. will the ResultSet/Statement will be closed ? Will there be any performance bottleneck on my Database Thanks, Lalit M.
About performance: a few years ago I worked on a project with a DB2 database, and after 250 unclosed Resultsets the webapplication just could not get anymore data from the database (the application seemed to "hang").
In short: close the connections, statements and resultsets. (do it in a finally block, so they will always get closed, even when an exception occurs).
I got tired of writing try-catch blocks around close calls and made this utility method:
It will close anything with a close() method. There is a closeable interface in the most recent JDKs so you could close some things without this reflection stuff. Note that null objects and objects that don't have close() methods all wind up in the catch.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi