-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin,
On 2/22/2009 10:26 AM, Martin Gainty wrote:
> catch (SQLException sqlEx)
> {
> try
> {
> resultset.close();
> statement.close();
> connection.close();
> }
It's kind of silly to call close() on all these resources in the
exception handles when you're just going to:
> finally
> {
> try
> {
> resultset.close();
> statement.close();
> connection.close();
> }
> catch(java.sql.SQLException excp)
> {
> log.debug("Exception on resultset/statement/connection close
> message="=excp.getMessage());
> }
> } //end finally..
...close them all in the finally block. Also, each close() method should
be surrounded by try/catch blocks and appropriate log messages. Finally,
logging exception stack traces is always helpful.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmiDwQACgkQ9CaO5/Lv0PBHmQCfcUww2dA6wQqlY/1PWpxUGA2b
XpsAn2Bg/V3AVSBWMDcFcax8A6DkUo50
=urPv
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]