JETTY配備で注意したデータベース接続の問題


問題の説明:
2012-05-25 09:34:22,712 WARN  [JDBCExceptionReporter.java:100] : SQL Error: 0, SQLState: 08S01
2012-05-25 09:34:22,714 ERROR [JDBCExceptionReporter.java:101] : The last packet successfully received from the server was65852 seconds ago.The last packet sent successfully to the server was 65852 seconds ago, which  is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
ソリューション:
修正するxmlファイルに関連するHibernateプロパティ
方法1:
<properties>
			<property name="hibernate.dialect"
  			value="org.hibernate.dialect.MySQL5Dialect" />
			<property name="hibernate.connection.driver_class"
				value="com.mysql.jdbc.Driver" />
			<property name="hibernate.connection.url"
				value="jdbc:mysql://localhost:3306?characterEncoding=utf-8" />
			<property name="hibernate.connection.username" value="root" />
			<property name="hibernate.connection.password" value="123" />
			<property name="hibernate.cache.provider_class"
				value="org.hibernate.cache.NoCacheProvider" />
			<property name="hibernate.connection.url" value="jdbc:mysql://server/dbname?autoReconnect=true" />
			<property name="hibernate.show_sql" value="false" />
  			<!--         ,MySQL   timeout   8  ,      25200     ,        -->
            		<property name="connection.provider_class"
               		 value="org.hibernate.connection.C3P0ConnectionProvider" />
            		<property name="hibernate.c3p0.acquire_increment" value="4" />
            		<property name="hibernate.c3p0.idle_test_period" value="3000" />
            		<property name="hibernate.c3p0.max_size" value="100" />
            		<property name="hibernate.c3p0.max_statements" value="15" />
            		<property name="hibernate.c3p0.min_size" value="5" />
            		<property name="hibernate.c3p0.timeout" value="25200" />
            		<property name="hibernate.c3p0.preferredTestQuery" value="select 1;" />
		</properties>

方法2:
<property name="hibernate.connection.url" value="jdbc:mysql://server/dbname?autoReconnect=true" />
<property name="hibernate.connection.autoReconnect" value="true" />
<property name="hibernate.connection.autoReconnectForPools" value="true" />