You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by shankarr <sh...@india.adventnet.com> on 2004/01/14 06:14:59 UTC

activeCount, useCount increasing automatically

Hi!
What is worrying me is that the number of activeCount and useCount are 
increasing though there have been no db interactions.
Any help, appreciated.

This is my data source entry from struts-config.xml file. Is there 
something wrong in it ?

   <data-sources>

     <data-source>
         <set-property property="driverClass" 
value="org.gjt.mm.mysql.Driver" />
         <set-property property="url" value="jdbc:mysql://localhost/" />
         <set-property property="maxCount" value="500"/>
         <set-property property="minCount" value="1"/>
         <set-property property="minIdle" value="10"/>
         <set-property property="testWhileIdle" value="true"/>
         <set-property property="timeBetweenEvictionRunsMillis" value="18000"/>
         <set-property property="testOnBorrow" value="true"/>
         <set-property property="maxActive" value="8"/>
         <set-property property="maxIdle" value="8"/>
         <set-property property="poolPreparedStatements" value="true"/>
         <set-property property="maxOpenPreparedStatements" value="2500"/>
         <set-property property="removeAbandoned" value="true"/>
         <set-property property="removeAbandonedTimeout" value="180"/>
         <set-property property="logAbandoned" value="true"/>
         <set-property property="validationQuery" value="select 1+1"/>
         <set-property property="user" value="root"/>
         <set-property property="password" value=""/>
     </data-source>

   </data-sources>

This is how I get my dbconnection in my action files

   Connection conn = null;
         Statement stmt = null;
         ResultSet rs = null;

         ServletContext context = servlet.getServletContext();
         DataSource dataSource = (DataSource) 
context.getAttribute(Action.DATA_SOURCE_KEY);
         String target = "success";
         conn = dataSource.getConnection();
         stmt = conn.createStatement();


I am getting the following in my tomcat prints.


INFO:    Found available connection
Jan 14, 2004 10:04:32 AM org.apache.struts.legacy.GenericDataSource 
getConnectio
n
INFO:    Return allocated connection, activeCount=29, useCount=29
Jan 14, 2004 10:04:34 AM org.apache.struts.legacy.GenericDataSource 
getConnectio
n
INFO:   getConnection()
Jan 14, 2004 10:04:34 AM org.apache.struts.legacy.GenericDataSource 
getConnectio
n
INFO:    Check for timeout, activeCount=29, useCount=29
Jan 14, 2004 10:04:34 AM org.apache.struts.legacy.GenericDataSource 
createConnec
tion
INFO:    createConnection()
Jan 14, 2004 10:04:34 AM org.apache.struts.legacy.GenericDataSource 
getConnectio
n
INFO:    Return new connection, activeCount=30, useCount=30
Jan 14, 2004 10:04:39 AM org.apache.struts.legacy.GenericDataSource 
getConnectio
n
INFO:   getConnection()
Jan 14, 2004 10:04:39 AM org.apache.struts.legacy.GenericDataSource 
getConnectio


Sha