mysql as datasource and closed idle connections

Halm Reusser halm.reusser at switch.ch
Mon Oct 1 05:21:41 EDT 2007


Dave,

David Spencer wrote:
> This problem can be solved at the Connection Pool rather than in the JDBC 
> Driver.
you're absolutely right. I've configured my deployerConfigContext.xml like:

       <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
                <property name="driverClassName">
                        <value>com.mysql.jdbc.Driver</value>
                </property>
                <property name="url">
                        <value>jdbc:mysql://127.0.0.1/database_vho</value>
                </property>

                <property name="validationQuery">
                        <value>SELECT 1</value>
                </property>

                <property name="testOnBorrow">
                        <value>true</value>
                </property>
        </bean>

The case, after restart of mysqld, is succesfully resolved, tomcat doesn't throw any exception. And when i trace the log:

	$ tail -f /var/log/mysql/mysql.log            
	6 Query       SELECT 1
	6 Query       Select count('x') from view_cas Where login = 'abc' And password = 'xyz'

it's shown that first the validationQuery is executed and after that, the authenticationQuery follows.

So, tomorrow morning (overnight the CAS will be idle) i'll test my second case, which throws the exception.

But, i believe your solution is working... :)


So, thank you very much for your quick and perfect help.

Halm Reusser



More information about the cas mailing list