1
votes

We have a Hibernate based application (to MySQL server) deployed in Tomcat 7.0.x

We needed to implement a timeout property where if the query runs longer than this set threshold value, the connection-query-thread should disconnect and return back to pool.

Do we have any property that can set either in Tomcat / Hibernate config?

Can removeAbandonedTimeout be used for this purpose? [https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html]

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
    <property name="url" value="${database.url}"></property>
    <property name="username" value="${database.username}"></property>
    <property name="password" value="${database.pwd}"></property>
    <property name="initialSize" value="8"></property>
    <property name="maxActive" value="30"></property>
    <property name="maxWait" value="10000"></property>
</bean>


    <property name="removeAbandonedTimeout" value="20"></property>   ??
1

1 Answers

0
votes

defaultQueryTimeout from https://commons.apache.org/proper/commons-dbcp/configuration.html

is the one which controls query/execution timeouts