I am using the connection pooling that is built in to EL in an app that runs on a non-JEE web server. We are seeing a problem where a network firewall is forcibly closing idle connections after an hour, and while EL resubmits the query, it takes 15 minutes for the timeout and retry to occur.
My question is this: is there a way I can tell the EMF to closed pooled connections after they have been idle for a period of time (e.g., 30 minutes) so as to avoid the firewall's non-graceful closing of the connections?
EclipseLink does not support any keepAlive in its internal connection pooling. You can either create your own background thread to ping the EclipseLink connection pool, or use a third party connection pool that supports a keepAlive (maybe Oracle UCP).
You can also try setting a timeout on your queries to decrease the timeout.
I'm using EL connection pooling and I'm getting exception like:
...com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too many connections
Got the latest stable release of EL and mysql connector.
is there any bug with EL pooling mechanism? should I use c3p0?