Kris Stephen
posted this on July 27, 2010 11:32 am
If you're running into problems every so often where users are unable to login or can't seem to connect to the database through Contour you may be losing connection to the database. The implementation below forces the database to refresh its connection and should ensure the connection no longer closes.
Stop Tomcat Service 1st
| Database | Validation Query |
|---|---|
| MySQL | select 1 |
| MS SQL Server | select 1 |
| Oracle | select 1 from dual |
Edit [%tomcat%]\webapps\contour\WEB-INF\contour-data.xml
Find:
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
</bean>
Replace with:
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="testOnBorrow"><value>true</value></property>
<property name="validationQuery"><value>select 1</value></property>
</bean>
Start Tomcat Service
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="maxActive"><value>20</value></property>
<property name="testOnBorrow"><value>true</value></property>
<property name="validationQuery"><value>select 1</value></property>
</bean>