Where does it close the connection? Looks like it gets it, but the close part 
is commented out. The rs gets closed, but the connection gets recycled. 
Theoretically.

Seems like you put a finally block down there to try catching/closing the 
wayward connection.


-----Original Message-----
From: Josh Gooding [mailto:josh.good...@gmail.com] 
Sent: Friday, October 30, 2009 1:43 PM
To: Tomcat Users List
Subject: Re: ConnectionPool question

I also found this tid bit lying around.  It get's a connection, but doesn't 
close the statement.

    public static void closeResources(ResultSet rs) throws 
AardvarkResourceException {
        try {
            Statement s = rs.getStatement();
            if (s != null) { // ResultSets produced by metadata queries do not 
have associated statements
                Connection c = s.getConnection();
                //s.close();
                //c.close();
                ConnectionPool.recycleConnection(c);
            }
            rs.close();
        } catch (SQLException e) {
            throw new AardvarkResourceException("Error closing resources 
associated with ResultSet", e);
        }
    }

It still doesn't close the statement, but closes the connection leaving the 
statement hanging.... I'll fix and make sure to use it.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to