Thanks for discovering this issue (and providing the patch) Steve.

I have created BEEHIVE-1201 to track this issue and should have the
fix committed shortly.


- Chad

On 7/9/07, Steven Dalton <[EMAIL PROTECTED]> wrote:
I think I've found a problem with this patch.



When setConnection(con) is used, the prepared statements created by the
JdbcControl, are not closed as part of the onRelease event.



Eventually my connection pool becomes exhausted as the connections
aren't closed completely. (SLEEPING)





I altered the JdbcControl to close these prepared statements and my
connections are released.



Specifically I moved the code



      if (_connection != null && !_externalConnection) {

            }



From the onRelease() method to the cleanupConnection() method to allow
the PreparedStatements to be closed.



IE



    private void cleanupConnection() {



        for (PreparedStatement ps : getResources()) {

            try {

                ps.close();

            }

            catch (SQLException sqe) {

                // noop

            }

        }

        getResources().clear();



        if (_connection != null && !_externalConnection) {
/*************************** Code Inserted
***************************************/



            try {

                  _connection.close();

            }

            catch (SQLException e) {

                  throw new ControlException("SQL Exception while
attempting to close database connection.", e);

            }

        _connection = null;

        _externalConnection = false;



        }

    }



Environment:



Beehive 1.0.2

Tomcat 5.5.20

Apache commons connection pool
(org.apache.commons.dbcp.BasicDataSourceFactory)

JTDS open source driver (net.sourceforge.jtds.jdbc.Driver)

SQL Server 2005





Steven Dalton








Reply via email to