org.hibernate.util.JDBCExceptionReporter – Communications link failure | SQL Error: 0, SQLState: 08S01

I noticed an exception like this one in one of our applications’ log and was investigating it. Here’s it:


[20:26:51] WARN [org.hibernate.util.JDBCExceptionReporter] – SQL Error: 0, SQLState: 08S01
[20:26:51] ERROR [org.hibernate.util.JDBCExceptionReporter] – Communications link failure

Last packet sent to the server was 96429 ms ago.
. . .
org.springframework.dao.DataAccessResourceFailureException: Cannot open connection; nested exception is org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(


Seems there was a stale connection at that point of time in Hibernate‘s C3P0 connection pool. MySQL might have timed out the connection, but C3P0 wasn’t probably configured with an appropriate value for idle_test_period and timeout properties, and hence the said connection might have stayed on without getting validated/removed. (The property idle_test_period defines the interval to test unchecked-out connections while timeout is the time unused connections can live in the pool.

If this is a one-off case, there’s no need to worry; just observe this failure over a period of time. If this happens frequently, we may need to double-check the values for above properties.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: