Hi,
I try to create a webservice in JAVA, using hibernate (last version) and MySQL!
All is OK, but after many hours without activity, MySQL return a connection error...
Quote:
The last packet successfully received from the server was121823 seconds ago.The last packet sent successfully to the server was 121823 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.
I tried to set 'autoReconnect=true' like this, in hibernate.cfg.xml, but the problem is always hehe...
Code:
<property name="hibernate.connection.url">jdbc:mysql://[IP]:3306/[DB_NAME]?autoReconnect=true</property>
All my hibernate.cfg.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">[PASS]</property>
<property name="hibernate.connection.url">jdbc:mysql://[IP]:3306/[DB_NAME]?autoReconnect=true</property>
<property name="hibernate.connection.username">[USER]</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping class="ch.................
Do you have an idea?
This web service is deployed on an ubuntu server, on toncat 5.5...
Thank's in advance.
++