tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Hartner <>
Subject Active DataSource Connection count never decreasing with PostgreSQL
Date Tue, 02 Feb 2010 19:44:47 GMT
I have developed an application which accesses a database via Hibernate as well as directly
via JDBC (datasource). The datasource is defined in the server.xml file as follows:

    <Context path="" docBase="AddressBookServer.war"> 

          <Environment name="LicenseFile" value="Licensekey.license" type="java.lang.String"
          <Environment name="BackupsFolder" value="../backups" type="java.lang.String"
          <Resource name="jdbc/AddressBookDB" auth="Container" type="javax.sql.DataSource"
             maxActive="25" maxIdle="5" maxWait="-1" removeAbandoned="true" removeAbandonedTimeout="60"
             username="sa" password="" driverClassName="org.h2.Driver"

          <Realm className="org.apache.catalina.realm.JDBCRealm"
            connectionName="sa" connectionPassword=""
            userTable="WEBUSERS" userNameCol="USERID" userCredCol="PASSWORD"
            userRoleTable="WEBROLES" roleNameCol="ACCESSROLE"/>


By default I use an embedded H2 database and everything works great. The numActive count goes
up during activity and decreases to 0 when there is no activity. Also the count generally
matches the actual connections to the database as one would expect. If I use the same application
with PostgreSQL 8.4 however, the numActive count goes up and up, and only sometimes down.
Generally sitting around 25 even though PostgreSQL only reports 4 idle connection. 

I already tried adding the following to my datasource configuration, however this did not
make any difference so far.
removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"

I am using Tomcat 6.0.18 on OS X 10.6.2 with Java 1.6.

Any suggestion on how I can debug this further why Tomcat reports an incorrect numActive count
and eventually runs out of possible connections. Currently it has to be restarted several
times a day with PostgreSQL.

Thanks in advance

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message