CraftConomy

154k Downloads

mySQL failure when trying to create a table

dddeeefff opened this issue ยท 3 comments

commented

I'm testing out craftconomy right now trying to find a lag source and I came across the below error.

What I am guessing is happening is that you don't prefix foreign key constraints when you try to make a table. I already have some craftconomy tables in this database.

https://github.com/greatman/craftconomy3/blob/master/src/main/java/com/greatmancode/craftconomy3/storage/sql/tables/BalanceTable.java

I don't have any real need to be able to create two craftconomy storage instances in a single database, but I'm reporting the issue anyway as it might affect others.

23:30:41 INFO]: dddeeefff issued server command: /ccsetup database prefix cc34_
[23:30:41 INFO]: [Craftconomy3] Loading the Database Manager
[23:30:41 WARN]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[23:30:41 WARN]: SLF4J: Defaulting to no-operation (NOP) logger implementation
[23:30:41 WARN]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[23:30:43 WARN]: java.sql.SQLException: Can't create table 'signshoptest.cc34_balance' (errno: 121)
[23:30:43 WARN]:        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
[23:30:43 WARN]:        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593)
[23:30:43 WARN]:        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525)
[23:30:43 WARN]:        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)
[23:30:43 WARN]:        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)
[23:30:43 WARN]:        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)
[23:30:43 WARN]:        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2111)
[23:30:43 WARN]:        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2407)
[23:30:43 WARN]:        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2325)
[23:30:43 WARN]:        at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2310)
[23:30:43 WARN]:        at com.greatmancode.com.zaxxer.libs.hikari.proxy.PreparedStatementProxy.executeUpdate(PreparedStatementProxy.java:61)
[23:30:43 WARN]:        at com.greatmancode.com.zaxxer.libs.hikari.proxy.PreparedStatementJavassistProxy.executeUpdate(PreparedStatementJavassistProxy.java)
[23:30:43 WARN]:        at com.greatmancode.craftconomy3.storage.sql.MySQLEngine.<init>(MySQLEngine.java:75)
[23:30:43 WARN]:        at com.greatmancode.craftconomy3.storage.StorageHandler.<init>(StorageHandler.java:40)
[23:30:43 WARN]:        at com.greatmancode.craftconomy3.Common.initialiseDatabase(Common.java:393)
[23:30:43 WARN]:        at com.greatmancode.craftconomy3.commands.setup.NewSetupDatabaseCommand.mysql(NewSetupDatabaseCommand.java:140)
[23:30:43 WARN]:        at com.greatmancode.craftconomy3.commands.setup.NewSetupDatabaseCommand.execute(NewSetupDatabaseCommand.java:48)
[23:30:43 WARN]:        at com.greatmancode.craftconomy3.tools.commands.SubCommand.execute(SubCommand.java:69)
[23:30:43 WARN]:        at com.greatmancode.craftconomy3.tools.commands.bukkit.BukkitCommandReceiver.onCommand(BukkitCommandReceiver.java:51)
[23:30:43 WARN]:        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
[23:30:43 WARN]:        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141)
[23:30:43 WARN]:        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:642)
[23:30:43 WARN]:        at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1135)
[23:30:43 WARN]:        at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:970)
[23:30:43 WARN]:        at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45)
[23:30:43 WARN]:        at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1)
[23:30:43 WARN]:        at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13)
[23:30:43 WARN]:        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
[23:30:43 WARN]:        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
[23:30:43 WARN]:        at net.minecraft.server.v1_8_R3.SystemUtils.a(SystemUtils.java:19)
[23:30:43 WARN]:        at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:714)
[23:30:43 WARN]:        at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:367)
[23:30:43 WARN]:        at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:653)
[23:30:43 WARN]:        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:556)
[23:30:43 WARN]:        at java.lang.Thread.run(Thread.java:745)
[23:30:43 INFO]: [Craftconomy3] Database Manager Loaded!
[23:30:43 INFO]: [Craftconomy3] Loading the Currency manager.
[23:30:43 INFO]: [Craftconomy3] Currency Manager Loaded!
commented

Hmm, good catch! Ill fix that.

commented

I have the same issue :(
Never used it at all and I need a plugin that allows me to use mysql with economy!
I think it might be cos i'm a newbie to mysql (got it for this plugin). I've created a table, but how should I set this table up? Does it have to have a certain name? What columns do I have to make? Thanks for any helps :)

EDIT:
Oh, my problem was with something about null primary keys. idk how to copy the error so I can't show you. It says that PRIMARY KEY must be NOT NULL
any help? It seems to work but i'm worried it might break some time.
Thanks :)

commented

Hopefully that build fixes it.