Notice! This post is more than a year old. It may be outdated.
I was trying to connect to a MySql database but every once in a while I got the following exception
As usual, I opened a new browser tab and started googling for possible solutions. To my amazement, I found a lot of proposed solutions. I’m going to list 2 of them that worked for me.
1. Add ?autoReconnect=true to you JDBC URL
2. Using DBCP as connection pool with Spring
Add the following entries to your datasource definition (the last 2 property elements):