We are using EJB3 Persistence with MySQL. We are having an issue where the connection is closed by MySQL after the default 8 hours of inactivity. Is there a property that can be set in JBOSS/EJB3 that can keep the connection active using keep alive or something similar.
I have tried setting the following properties in the EJB3 persistence.properties file. But it did not seem to fix the problem.
We are using the mysql 3.1 connector, we tried using the mysql 5.0.7 connector as well but still the timeout causes a socket error on the jboss side.
Can you please let me know what parameters should be set or point me to the right literature.
I guess, you will have to configure the datasource for either the idle-timeout-minutes property or the check-valid-connection-sql property. Either of these will remove an invalid (closed) connection from the pool and create a new one in the pool. Have a look at http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfigDataSources for more details.