MySQL jdbc驱动程序自动重新连接不起作用

问题描述 投票:-1回答:1

我正在开发一个Spigot插件,并希望使用MySql连接。我之前已经做过,所以这不是真正的问题。但是更早之前我得到了一个错误,即驱动程序尚未从服务器bla bla收到任何数据包。因此,MySql连接被取消了。我搜索了一个解决方案,发现可以使用'autoReconnect = true'参数。从那一刻起,一切工作正常。但是现在我有一个问题,我使用此参数,但仍然收到一个错误,告诉我使用“ autoReconnect = true”。

MyMySql连接字符串:

"jdbc:mysql://" + HOST + ":3306/" + DATABASE + "?autoReconnect=true&tcpKeepAlive=true&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Europe/Berlin"

错误:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 37,984,987 milliseconds ago.  The last packet sent successfully to the server was 37,984,987 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

希望有人可以帮助我

mysql jdbc bukkit
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.