Issue
I am working with a Java Web application(spring mvc) connecting to a Mysql database .
When i left my application overnight and there is no request to process during the night, in the morning it was throwing java.sql.SQLException: Communication link failure: java.net.SocketException, underlying cause: Software caused connection abort: recv failed
error.
i am using Apache JDBC connection pool i.e. in my Spring config file.
I did some research and found that the real cause of the problem was that database timed out the connection when left idle and when Java application tries to connect to the database using those stale connection it throws
java.sql.SQLException: Communication link failure:
java.net.SocketException, underlying cause: Software caused connection abort: recv failed error.
Solution
i fixed this probleme by increasing the timeout value in mysql config file = C:\Program Files (x86)\MySQL\MySQL Server 5.1\my.ini :
[mysqld] wait_timeout=2147483 interactive_timeout=2147483
and then i have restarted mysql service.
thank you @EJP
Answered By - habiba kessraoui
Answer Checked By - Robin (JavaFixing Admin)