-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor
-
None
-
Affects Version/s: None
-
None
-
Environment:
This server is running CraftBukkit version 3888-Spigot-a0f3d48-e62905a (MC: 1.20.2) (Implementing API version 1.20.2-R0.1-SNAPSHOT)
-
1.20.2
-
Yes
When executing an insert with the updated SQLite driver now yields an error when using RETURN_GENERATED_KEYS.
try (PreparedStatement insert = connection.prepareStatement( "INSERT INTO `table_name`(`data`) VALUES (?)", Statement.RETURN_GENERATED_KEYS)) { insert.setObject(1, data); insert.executeUpdate(); try (ResultSet result = insert.getGeneratedKeys()) { // Exception is thrown here if (result.next()) { data.setId(result.getInt(1)); } } }
The exception that is thrown is:
java.lang.RuntimeException: java.sql.SQLFeatureNotSupportedException: not implemented by SQLite JDBC driver at com.andavin.images.data.SQLDataManager.save(SQLDataManager.java:88) ~[?:?] at com.andavin.images.data.SQLiteDataManager.save(SQLiteDataManager.java:39) ~[?:?] at com.andavin.images.Images.addImage(Images.java:381) ~[?:?] at com.andavin.images.command.CreateCommand.lambda$onInteract$5(CreateCommand.java:205) ~[?:?] at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3888-Spigot-a0f3d48-e62905a] at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3888-Spigot-a0f3d48-e62905a] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?] at java.lang.Thread.run(Thread.java:833) ~[?:?] Caused by: java.sql.SQLFeatureNotSupportedException: not implemented by SQLite JDBC driver at org.sqlite.jdbc3.JDBC3PreparedStatement.unsupported(JDBC3PreparedStatement.java:448) ~[sqlite-jdbc-3.43.0.0.jar:?] at org.sqlite.jdbc3.JDBC3Statement.getGeneratedKeys(JDBC3Statement.java:357) ~[sqlite-jdbc-3.43.0.0.jar:?] at com.andavin.images.data.SQLDataManager.save(SQLDataManager.java:147) ~[?:?] at com.andavin.images.data.SQLDataManager.save(SQLDataManager.java:86) ~[?:?] ... 8 more
This exception is not thrown in 1.20.1 and looks like a regression in the new version of SQLite and the update to that version is possibly premature.