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" override="true"/>
<Environment name="BackupsFolder" value="../backups"
type="java.lang.String" override="true"/>
<Resource name="jdbc/AddressBookDB" auth="Container"
type="javax.sql.DataSource"
maxActive="25" maxIdle="5" maxWait="-1" removeAbandoned="true"
removeAbandonedTimeout="60" logAbandoned="true"
username="sa" password="" driverClassName="org.h2.Driver"
url="jdbc:h2:tcp://localhost:28081/../db/AddressBookDB;LOCK_TIMEOUT=60000"/>
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="org.h2.Driver"
connectionURL="jdbc:h2:tcp://localhost:28081/../db/AddressBookDB;LOCK_TIMEOUT=60000"
connectionName="sa" connectionPassword=""
userTable="WEBUSERS" userNameCol="USERID" userCredCol="PASSWORD"
userRoleTable="WEBROLES" roleNameCol="ACCESSROLE"/>
</Context>
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
Alex
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]