I'm having an issue where my connection times out after 8 hours of no activity.
The connection never get connected again which leads me to restart my web application.
I was trying to search for a solution and the only one I found was to use an external connection pool.
There is no build in solution for this in Eclipselink? I know Hibernate have the option to check the connection every time before performing any query.
Thanks for your quick response!
I'm using version 2.5.1, the issue only occurs when I'm trying write, read queries are not failing at all.
I believe I found that the issue occurs when tomcat randomly restart itself and then I cannot write anymore.
I guess it can be that the default connection pool cannot acquire a connection and just hangs there forever.
I found out that the PingSQL is set to the correct one so I guess it wouldn't help to customize the session.
Setting the autoConnect for mysql did not help too, I'm not sure what to do anymore.
I also have another issue now, sometimes I'm getting an exception:
Exception [EclipseLink-4005] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: DatabaseAccessor not connected.
That might happen if the underlying session is logged out while another thread is still using it. How are you obtaining EntityManager and EntityManagerFactory instances? Be sure not to close the factory instances until the EntityManager is done being used.
As for the write connection issue, more information is needed, such as when it is occurring and what the threads are doing that they hang. Try getting a thread dump to see what is happening.