MySQL closed connection - How to fix it?

Discussion in 'Plugin Development' started by CraftRay, Apr 21, 2016.

Thread Status:
Not open for further replies.
  1. Why my connection with MySQL was closed, when none player dont join to server and server was empty for a long time? How to fix it?

     com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 70 501 576 milliseconds ago.  The last packet sent successfully to the server was 70 501 576 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.
    [19:06:21] [Server thread/WARN]:     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    [19:06:21] [Server thread/WARN]:     at sun.reflect.NativeConstructorAccessorImpl.newInstance(
    [19:06:21] [Server thread/WARN]:     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
    [19:06:21] [Server thread/WARN]:     at java.lang.reflect.Constructor.newInstance(
    [19:06:21] [Server thread/WARN]:     at com.mysql.jdbc.Util.handleNewInstance(
    [19:06:21] [Server thread/WARN]:     at com.mysql.jdbc.SQLError.createCommunicationsException(
    [19:06:21] [Server thread/WARN]:     at com.mysql.jdbc.MysqlIO.send(
    [19:06:21] [Server thread/WARN]:     at com.mysql.jdbc.MysqlIO.sendCommand(
    [19:06:21] [Server thread/WARN]:     at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
    [19:06:21] [Server thread/WARN]:     at com.mysql.jdbc.ConnectionImpl.execSQL(
    [19:06:21] [Server thread/WARN]:     at com.mysql.jdbc.PreparedStatement.executeInternal(
    [19:06:21] [Server thread/WARN]:     at com.mysql.jdbc.PreparedStatement.execute(
    [19:06:21] [Server thread/WARN]:     at
    [19:06:21] [Server thread/WARN]:     at
    [19:06:21] [Server thread/WARN]:     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [19:06:21] [Server thread/WARN]:     at sun.reflect.NativeMethodAccessorImpl.invoke(
    [19:06:21] [Server thread/WARN]:     at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    [19:06:21] [Server thread/WARN]:     at java.lang.reflect.Method.invoke(
    [19:06:21] [Server thread/WARN]:     at$1.execute(
    [19:06:21] [Server thread/WARN]:     at org.bukkit.plugin.RegisteredListener.callEvent(
    [19:06:21] [Server thread/WARN]:     at org.bukkit.plugin.SimplePluginManager.fireEvent(
    [19:06:21] [Server thread/WARN]:     at org.bukkit.plugin.SimplePluginManager.callEvent(
    [19:06:21] [Server thread/WARN]:     at net.minecraft.server.v1_7_R4.PlayerList.c(
    [19:06:21] [Server thread/WARN]:     at net.minecraft.server.v1_7_R4.PlayerList.a(
    [19:06:21] [Server thread/WARN]:     at net.minecraft.server.v1_7_R4.LoginListener.c(
    [19:06:21] [Server thread/WARN]:     at net.minecraft.server.v1_7_R4.LoginListener.a(
    [19:06:21] [Server thread/WARN]:     at net.minecraft.server.v1_7_R4.NetworkManager.a(
    [19:06:21] [Server thread/WARN]:     at net.minecraft.server.v1_7_R4.ServerConnection.c(
    [19:06:21] [Server thread/WARN]:     at net.minecraft.server.v1_7_R4.MinecraftServer.v(
    [19:06:21] [Server thread/WARN]:     at net.minecraft.server.v1_7_R4.DedicatedServer.v(
    [19:06:21] [Server thread/WARN]:     at net.minecraft.server.v1_7_R4.MinecraftServer.u(
    [19:06:21] [Server thread/WARN]:     at
    [19:06:21] [Server thread/WARN]:     at
    [19:06:21] [Server thread/WARN]: Caused by: Przerwany potok
    [19:06:21] [Server thread/WARN]:     at Method)
    [19:06:21] [Server thread/WARN]:     at
    [19:06:21] [Server thread/WARN]:     at
    [19:06:21] [Server thread/WARN]:     at
    [19:06:21] [Server thread/WARN]:     at
    [19:06:21] [Server thread/WARN]:     at com.mysql.jdbc.MysqlIO.send(
    [19:06:21] [Server thread/WARN]:     ... 26 more
  2. Offline


    Maybe read the first line...
    Zombie_Striker and CraftRay like this.
  3. Offline


    @CraftRay Connections time out, just open it again. (If the server is going to be empty for that long you should close it anyway)
  4. Offline


    Also, make sure you run this asynchronously. You don't want to wait for responses form the SQL server on the main thread!
  5. Offline



    String connectionURL = "jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.database + "?autoReconnect=true";
Thread Status:
Not open for further replies.

Share This Page