tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Christiansen" <Nathan_Christian...@tni.com>
Subject MySQL DBCP pool exausted error message
Date Wed, 17 Sep 2003 17:20:09 GMT
When I stress test my web app using JMeter, I am suddenly getting a "DBCP could not obtain
an idle db connection, pool exhausted" SQLException thrown.

When I test with 25 simulated users every one of my 25 threads gets the exception after the
first 25 requests.

What am I doing wrong?

My setup:

RH Linux 7.1
Java 1.4.1_01
Tomcat 4.1.24
DBCP 1.0

MySQL 3.23.56


My pertinent DBCP configuration:

removeAbandoned = true
maxActive = 25
maxIdle = 10
maxWait = 10000
url ends with ?autoReconnect=true

I double checked that all of my database connections in my code follow the pattern of:

Connection conDBConnection = getConnection();
PreparedStatement psDBStatement = null;
ResultSet rsDBResult = null;
  
try
{
  psDBStatement = conDBConnection.prepareStatement("select query from views where viewid =
?");
  psDBStatement.setInt(1, nViewID);
  rsDBResult = psDBStatement.executeQuery();
      
  if (rsDBResult.next())
  {
    strReturnValue = rsDBResult.getString(1);
  }
}
catch (SQLException sqle)
{
  sqle.printStackTrace();
  strReturnValue = null;
}
finally
{
  try
  {
    if (rsDBResult != null) rsDBResult.close();
    if (psDBStatement != null) psDBStatement.close();
    if (conDBConnection != null) conDBConnection.close();
  }
  catch (SQLException sqle)
  {
    sqle.printStackTrace();
  }
}




-- Nathan Christiansen
   Tahitian Noni International
   http://www.tahitiannoni.com

Mime
View raw message