I think that within your finally block you need a second, nested try that has a catch block which just logs any exception. I think that I would even put a try-catch around each of the close() method calls so that if one fails, the other resources will stll be released.
I believe that this would catch any exceptions as a result of calling close(). I believe that whenever you close anything like a connection (or a file), all you can do is try and if there's an error, I don't know what else you can do but just log it.
I believe that before calling each close() method, that you should check that the object that you are about to close is not null so that you don't get a NullException when you're just trying to close everything up.
[ May 21, 2007: Message edited by: Kaydell Leavitt ] [ May 21, 2007: Message edited by: Kaydell Leavitt ]
close() method of resultset, statement and connection throws SQLException, so you need to put that also in a try-catch block. Before calling close it's better to check that they are not null, otherwise you will get a NullPointerException. So your finally block should look like this:
Ravinder Rana is correct that you need to check for nulls. But I would have two try blocks inside each other. You started off with this:-Now set up two try blocks inside each other, like this:-. . but that won't work until you move the finally. . . then add the if(stmt != null) tests as suggested before.
Clean up some indenting etc.[/edit] [ May 28, 2007: Message edited by: Campbell Ritchie ]