1

Database connection question

aman207 9/19/13 7:16 pm
440
Hello all,

My plugin depends on a database and for some reason, one of my users gets a intermittent SQL exception that says

2013-09-19 06:16:12 [SEVERE] com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 132,202 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.

2013-09-19 06:16:12 [SEVERE] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

2013-09-19 06:16:12 [SEVERE] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

2013-09-19 06:16:12 [SEVERE] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

2013-09-19 06:16:12 [SEVERE] at java.lang.reflect.Constructor.newInstance(Unknown Source)

2013-09-19 06:16:12 [SEVERE] at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)

2013-09-19 06:16:12 [SEVERE] at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)

2013-09-19 06:16:12 [SEVERE] at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3082)

2013-09-19 06:16:12 [SEVERE] at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2968)

2013-09-19 06:16:12 [SEVERE] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3516)

2013-09-19 06:16:12 [SEVERE] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)

2013-09-19 06:16:12 [SEVERE] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)

2013-09-19 06:16:12 [SEVERE] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2620)

2013-09-19 06:16:12 [SEVERE] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2570)

2013-09-19 06:16:12 [SEVERE] at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1474)

2013-09-19 06:16:12 [SEVERE] at net.targetcraft.donatorexpress.CommandListener.onCommand(CommandListener.java:843)

2013-09-19 06:16:12 [SEVERE] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)

2013-09-19 06:16:12 [SEVERE] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:192)

2013-09-19 06:16:12 [SEVERE] at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchCommand(CraftServer.java:523)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.PlayerConnection.handleCommand(PlayerConnection.java:954)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.PlayerConnection.chat(PlayerConnection.java:872)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.PlayerConnection.a(PlayerConnection.java:829)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.Packet3Chat.handle(SourceFile:49)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.NetworkManager.b(NetworkManager.java:296)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.PlayerConnection.e(PlayerConnection.java:116)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.ServerConnection.b(SourceFile:37)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.DedicatedServerConnection.b(SourceFile:30)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:590)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:226)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:486)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:419)

2013-09-19 06:16:12 [SEVERE] at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)

2013-09-19 06:16:12 [SEVERE] Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

2013-09-19 06:16:12 [SEVERE] at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2529)

2013-09-19 06:16:12 [SEVERE] at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2979)

2013-09-19 06:16:12 [SEVERE] ... 24 more


Now I think that Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. is the problem. However I am not sure if it is my plugin or the database. The user said that he uses other plugins that connect to the same database and they never have any trouble which leads me to believe that it is my coding. He hosts his database locally on a VPS

To connect to the database, the plugin connects once on startup and disconnects on shutdown. If it encounters a SQL exception, it tries to connect to the database again.

Anybody have any suggestions?

Thanks
Posted by
aman207
Level 40 : Master Cake
50

  Have something to say?

JoinSign in

Welcome