tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Suggestions for connection pooling
Date Thu, 25 Oct 2007 21:34:13 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Len,

Len Popp wrote:
>        Connection conn = ds.getConnection();
>        try {
>            ...do something...
>        } finally {
>            conn.close();
>        }

Might I further suggest:

        Connection conn = ds.getConnection();
        try {
            ...do something...
        } finally {
            try { conn.close(); } catch (SQLException sqle)
            { logger.error("Could not close connection", sqle);
        }


It's always nice not to swallow exceptions that are thrown inside try
blocks ;)

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

iD8DBQFHIQvV9CaO5/Lv0PARAorCAJ0R9wTn+RlvN+1Fsvlu9dB9lPlQjACdHuY3
YT0jQ0kAdKW7Sm4uxnfSSaw=
=k8Di
-----END PGP SIGNATURE-----

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


Mime
View raw message