This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
code 1: Yes you should close the result set before assigning a new ResultSet object to the rs variable.
code 2: Yep same as above. Except in the case I would close the statement also. But I would change it to make sure your prepared statement can be cached. see below.
Of course according to the specs if you close a statement its result set will also be closed so if you are closing your statement in finally this probably isn't much of a problem. But I feel its always best to call close() explicitly on all JDBC objects.
I'd rewrite case 2 to be more like
[ December 06, 2006: Message edited by: Tim LeMaster ]