-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard,

Richard S. Huntrods wrote:
| I FIXED THE PROBLEM!!!!!
|
| Yep - totally fixed (tested and verified).
|
| What I decided to do was to move the close statements (and nulling RSMD)
| into the FINALLY block - it seemed pointless to duplicate code. When you
| must have the close() statements in finally, why put them in the main
| code as well?
|
| So I modified ALL my DBMS methods as follows (just showing the finally
| block):
|
|         finally {
|             try {
|                 if(resultSet != null) {
|                     resultSet.close();
|                     resultSet = null;
|                 }
|                 if(statement != null) {
|                     statement.close();
|                     statement = null;
|                 }
|             }
|             catch (Exception e) {
|             }
|         }
|
| In doing this, I found several methods I missed earlier - they were
| update and delete methods that didn't use ResultSet so I had missed
| adding the statement.close().

I told you. ;)

Note that you need to have each close() in its own try/catch block: you
don't want an exception in closing the ResultSet object to prevent your
Statement from closing.

| So once I was done, EVERY METHOD in the DBMS class had appropriate
| closes on resultsets and statements (as appropriate) - all placed in the
| finally block.

Yup. There can always be that /one/ method that's not fixed, and if you
run it enough times, it'll kill you.

I suspect that the change you are experiencing between Connector/J
versions is that the newer versions either do not implement finalizers
(which were hardly implemented in certain JVMs, anyway) anymore, or some
sort of cleanup code was removed, because the JDBC spec was clarified to
mandate that resources be cleaned up by the calling code (and therefore
the driver is not responsible for sloppy coding of the client).

Glad you have your solution. Next time remember that you might be so
deep in your own code that you aren't open to questions and suggestions.
Remember to re-evaluate your assumptions, especially when someone is
trying to help ;)

Good luck,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkihx4oACgkQ9CaO5/Lv0PB8QwCgnhWLFBi3GfWLEpYCKfFjBRbT
9OkAnAobAbaQOFKVurnnnSZto7tUTiMJ
=F1Pl
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to