ApplicationProgramEstablish a connection with the database. If the application does not access the database for more than 8 hours, the database will be disconnected. Then, an exception will be thrown during the next access, as shown below:
Communications link failure due
Underlying exception:
** Begin nested exception **
Java. Io. eofexception
Stacktrace:
Java. Io. eofexception
At com. MySQL. JDBC. mysqlio. readfully (mysqlio. Java: 1913 )
At com. MySQL. JDBC. mysqlio. reuseandreadpacket (mysqlio. Java: 2304 )
At com. MySQL. JDBC. mysqlio. checkerrorpacket (mysqlio. Java: 2803 )
At com. MySQL. JDBC. mysqlio. sendcommand (mysqlio. Java: 1573 )
...
OnlineArticleMost of the solutions are to add the "autoreconnect = true" option to the database connection string. However, this is only valid for versions earlier than MySQL 4. This cannot be done in the latest MySQL. In fact, it is very easy to solve this problem, that is, to modify the MySQL startup parameters. By default, the timeout time of MySQL is 28800 seconds, that is, 8 hours. If you add a value of 0, the problem is solved.
Mysqld -- Interactive_timeout = 288000
You can also add this parameter to the "My. ini" file.