MySQL Errors

Discussion in 'Spigot Plugin Development' started by Justin393, Dec 14, 2015.

  1. Whenever I try and create a new player I get this:

    14.12 11:18:54 [Server] WARN at java.lang.Thread.run(Thread.java:745)
    14.12 11:18:54 [Server] WARN at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    14.12 11:18:54 [Server] WARN at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    14.12 11:18:54 [Server] WARN at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
    14.12 11:18:54 [Server] WARN at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
    14.12 11:18:54 [Server] WARN at com.mysticraft.util.DatabaseManager$2.run(DatabaseManager.java:112)
    14.12 11:18:54 [Server] WARN at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2310)
    14.12 11:18:54 [Server] WARN at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2325)
    14.12 11:18:54 [Server] WARN at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2407)
    14.12 11:18:54 [Server] WARN at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2111)
    14.12 11:18:54 [Server] WARN at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)
    14.12 11:18:54 [Server] WARN at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)
    14.12 11:18:54 [Server] WARN at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)
    14.12 11:18:54 [Server] WARN at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525)
    14.12 11:18:54 [Server] WARN at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593)
    14.12 11:18:54 [Server] WARN at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
    14.12 11:18:54 [Server] WARN at com.mysql.jdbc.Util.getInstance(Util.java:382)
    14.12 11:18:54 [Server] WARN at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
    14.12 11:18:54 [Server] WARN at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    14.12 11:18:54 [Server] WARN at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    14.12 11:18:54 [Server] WARN at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    14.12 11:18:54 [Server] WARN at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    14.12 11:18:54 [Server] WARN com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '9bdd0741273143a182b716c6a3631111' in 'field list'
    14.12 11:18:54 [Multicraft] justin_393 ran command Message of the Day
    14.12 11:18:54 [Connect] User justin_393, IP 70.198.68.50
    14.12 11:18:54 [Server] INFO UUID of player justin_393 is 9bdd0741-2731-43a1-82b7-16c6a3631111

    Also, whenever I try to query I get this:

    14.12 11:17:52 [Server] WARN at java.lang.Thread.run(Thread.java:745)
    14.12 11:17:52 [Server] WARN at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    14.12 11:17:52 [Server] WARN at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    14.12 11:17:52 [Server] WARN at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
    14.12 11:17:52 [Server] WARN at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
    14.12 11:17:52 [Server] WARN at com.mysticraft.util.DatabaseManager$5.run(DatabaseManager.java:183)
    14.12 11:17:52 [Server] WARN at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:7145)
    14.12 11:17:52 [Server] WARN at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:794)
    14.12 11:17:52 [Server] WARN at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
    14.12 11:17:52 [Server] WARN at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
    14.12 11:17:52 [Server] WARN at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
    14.12 11:17:52 [Server] WARN at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
    14.12 11:17:52 [Server] WARN java.sql.SQLException: Operation not allowed after ResultSet closed

    Here's the entire class: http://hastebin.com/esinovejih.avrasm
     
  2. You need to surround the string (UUID) you are putting into your query with single quotes. Right now, the query ends up looking like this:
    so it's looking for a column called 9bdd0741-2731-43a1-82b7-16c6a3631111 as it is not a valid number (Unknown column '9bdd0741273143a182b716c6a3631111' in 'field list').
     
    • Informative Informative x 1
  3. @Tudedude is right. Also For the issues of the query you are closing the resultset in a while loop. Try moving the lines rs.close(); and stmt.close(); outside of the while loops. This way it won't close it before it can call rs.next() and also if it does not return any results it can still close the result set and statement
     
    #3 Skriglitz, Dec 14, 2015
    Last edited: Dec 14, 2015