tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakarta Tomcat Newsgroup (@Basebeans.com) <jakarta-...@basebeans.com>
Subject Commons DBCP and closing connections
Date Sat, 24 Aug 2002 02:10:09 GMT
Subject: Commons DBCP and closing connections
From: Matt Raible <matt@raibledesigns.com>
 ===
I am trying to upgrade from using Tyrex 0.9.7 to DBCP (from Struts 1.1 b2) -
and I have the following method that used to work fine:

    /** Closes a connection from the connection pool */
    public void closeConnection(Connection con) throws
ServiceLocatorException
    {
        try {
            con.close();
        } catch (SQLException sqle) {
            logger.error("SQLException: " + sqle.getMessage());
            throw new ServiceLocatorException(sqle);
        } finally {
            if (con != null) {
                // try again
                try {
                    con.close();
                } catch (SQLException csqle) {
                    // ignore
                }
            }
        }
    }

But now it causes a "connection closed" error??  I thought when you were
using a connection pool, "closing" the connection just releases it back to
the pool.  Am I doing this right??

Matt


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message