I have a server where I have several web applications connected to the database (
Mysql ). The problem is that if some system is idle it loses the connection with the bank and I have to give a refresh in the application so that everything returns to normal.
I was circumventing this problem with a
Thread pinging the database every 1 hour. But now that I'm working with
WEBServices this method is no longer working.
I have read in some places that
Mysql overturns all connections if idle for 8 hours. And I also found several possible solutions, such as configuring
C3P0 , etc. But even making these settings the error still persists. In the Log of
Tomcat I have these errors:
Caused by: org.hibernate.TransactionException: commit failed Caused by: org.hibernate.TransactionException: unable to commit against JDBC connection Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed. Caused by: java.net.SocketException: Software caused connection abort: socket write error
Hibernate , and my settings look like this:
<!-- Database connection settings --> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost:3306/bd</property> <property name="connection.username">root</property> <property name="connection.password"></property> <property name="connection.autoReconnect">true</property> <property name="connection.autoReconnectForPools">true</property> <!-- C3P0 --> <property name="c3p0.acquire_increment">5</property> <property name="c3p0.timeout">0</property> <property name="c3p0.min_size">3</property> <property name="c3p0.max_size">100</property> <property name="c3p0.max_statements">0</property> <property name="c3p0.idle_test_period">3000</property>
timeout to 0 because in some places they say that the connection never expires, but it continues to expire.
Is my setup right? Do I need to do any other configuration? Is there another way to solve this problem?
I noticed that even with these errors I can still add, change and edit the data, but whenever I try to perform one of these operations, I have a