#JDBC SQLite: Syntax error near "ON"

8 messages · Page 1 of 1 (latest)

coral charm
#

Hello, I'm making a simple warps plugin for Spigot 1.12.2+ on Java 8. I want to do an upsert in my setwarp command using the ON CONFLICT DO UPDATE clause, however I am presented with a syntax error near "ON" according to error logs. Below is the SQL statement and logs:

INSERT INTO Warps (PlayerUuid, WarpName, WarpX, WarpY, WarpZ) VALUES (?, ?, ?, ?, ?)
ON CONFLICT (PlayerUuid, WarpName) DO 
UPDATE SET WarpX = excluded.WarpX, WarpY = excluded.WarpY, WarpZ = excluded.WarpZ
org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (near "ON": syntax error)
        at org.sqlite.core.DB.newSQLException(DB.java:909) ~[patched_1.12.2.jar:git-Paper-1620]
        at org.sqlite.core.DB.newSQLException(DB.java:921) ~[patched_1.12.2.jar:git-Paper-1620]
        at org.sqlite.core.DB.throwex(DB.java:886) ~[patched_1.12.2.jar:git-Paper-1620]
        at org.sqlite.core.NativeDB.prepare_utf8(Native Method) ~[patched_1.12.2.jar:git-Paper-1620]
        at org.sqlite.core.NativeDB.prepare(NativeDB.java:127) ~[patched_1.12.2.jar:git-Paper-1620]
        at org.sqlite.core.DB.prepare(DB.java:227) ~[patched_1.12.2.jar:git-Paper-1620]
        at org.sqlite.core.CorePreparedStatement.<init>(CorePreparedStatement.java:41) ~[patched_1.12.2.jar:git-Paper-1620]
        at org.sqlite.jdbc3.JDBC3PreparedStatement.<init>(JDBC3PreparedStatement.java:30) ~[patched_1.12.2.jar:git-Paper-1620]
        at org.sqlite.jdbc4.JDBC4PreparedStatement.<init>(JDBC4PreparedStatement.java:19) ~[patched_1.12.2.jar:git-Paper-1620]
        at org.sqlite.jdbc4.JDBC4Connection.prepareStatement(JDBC4Connection.java:48) ~[patched_1.12.2.jar:git-Paper-1620]
        at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:263) ~[patched_1.12.2.jar:git-Paper-1620]
        at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:235) ~[patched_1.12.2.jar:git-Paper-1620]
        at net.cobaltonline.simplewarps.Util.setWarp(Util.java:68) ~[?:?]
...
spice currentBOT
#

This post has been reserved for your question.

Hey @coral charm! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

velvet geyser
#

Why do you think that ON CONFLICT would exist like that?

#

like you could just do ON CONFLICT REPLACE or similar maybe

#

actually can you share your code?

#

Also make sure you are using SQLite 3.24.0 or later