gpt4 book ai didi

java - SQLITE_ERROR - SQL 错误或丢失数据库(接近 "AUTOINCREMENT": syntax error)

转载 作者:行者123 更新时间:2023-12-02 03:19:18 25 4
gpt4 key购买 nike

我正在尝试在新创建的 SQLite 数据库中创建一个表。由于某种原因,我收到 SQLException:

try {
logger.debug("Trying to create table powerperms_permissions if not exists");
statement.execute("CREATE TABLE IF NOT EXISTS powerperms_permissions ( "
+ "id INT NOT NULL AUTOINCREMENT,"
+ "uuid VARCHAR ( 64 ) NOT NULL,"
+ "permission VARCHAR ( 64 ) NOT NULL,"
+ "world VARCHAR ( 32 ) NULL,"
+ "PRIMARY KEY ( id ) );");
} catch (SQLException e) {
logger.error("Couldn't create permissions table",e);
}

抛出

[07:49:17 ERROR]: [PowerPerms] Couldn't create permissions table
java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (near "AUTOINCREMENT": syntax error)
at org.sqlite.DB.newSQLException(DB.java:383) ~[spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
at org.sqlite.DB.newSQLException(DB.java:387) ~[spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
at org.sqlite.DB.throwex(DB.java:374) ~[spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
at org.sqlite.NativeDB.prepare(Native Method) ~[spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
at org.sqlite.DB.prepare(DB.java:123) ~[spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
at org.sqlite.Stmt.execute(Stmt.java:113) ~[spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
at eu.taigacraft.powerperms.Main.registerSqlite(Main.java:240) [PowerPerms_v1.0.jar:?]
at eu.taigacraft.powerperms.Main$2.run(Main.java:48) [PowerPerms_v1.0.jar:?]
at org.bukkit.craftbukkit.v1_10_R1.scheduler.CraftTask.run(CraftTask.java:71) [spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
at org.bukkit.craftbukkit.v1_10_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53) [spigot-1.10.jar:git-Spigot-6016ac7-10c10b3]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_72]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_72]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_72]

为什么?

最佳答案

您可以使用AUTOINCREMENT keyword仅适用于INTEGER PRIMARY KEY,而非INT NOT NULL

关于java - SQLITE_ERROR - SQL 错误或丢失数据库(接近 "AUTOINCREMENT": syntax error),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39830885/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com