Ok, thank you for your answer. So my understanding is that if I want to use a datasource managed by Tomcat's default DBCP connection pooling, I should only use the
Code:
hibernate.connection.datasource
property.
And that's exactly what I do, in fact... My problems come from the fact that I keep getting a JDBC exception from Hibernate after some server uptime: "Connection already closed'. I don't have the entire backtrace anymore, sorry, and it is not reproduceable, for now. It is true that there are other programs connection to the same database by pure JDBC; some others even by Windows ODBC.
Here is my Tomcat JNDI datasource configuration, in case somebody already met this situation (this is the web-application's <context>):
Code:
<Resource name="jdbc/production" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/production">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>5</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<parameter>
<name>username</name>
<value>USER</value>
</parameter>
<parameter>
<name>password</name>
<value>PASSWORD</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.sybase.jdbc2.jdbc.SybDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:sybase:Tds:MACHINE:5000/base</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>removeAbandonedTimeout</name>
<value>1800</value>
<!-- 30 minutes * 60 secondes -->
</parameter>
<parameter>
<name>logAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>defaultAutoCommit</name>
<value>false</value>
</parameter>
<parameter>
<name>testOnBorrow</name>
<value>true</value>
</parameter>
<parameter>
<name>testOnReturn</name>
<value>true</value>
</parameter>
<parameter>
<name>validationQuery</name>
<value>select 1</value>
</parameter>
</ResourceParams>