SQL Exception when running Minecraft plugin

So I have this sql script
CREATE TABLE IF NOT EXISTS players (
    id INT AUTO_INCREMENT,
    name VARCHAR(16) NOT NULL,
    uuid VARCHAR(36) NOT NULL,
    PRIMARY KEY (id)
);
                
CREATE TABLE IF NOT EXISTS friendsystemSettings (
    id INT AUTO_INCREMENT,
    playerID INT NOT NULL,
    friendrequests BOOLEAN NOT NULL DEFAULT '1',
    messagesfromstrangers BOOLEAN NOT NULL DEFAULT '1',
    PRIMARY KEY (id)
);
                
CREATE TABLE IF NOT EXISTS friendsystemPlayertofriend (
    id INT AUTO_INCREMENT,
    playerID INT NOT NULL,
    friendID INT NOT NULL,
    PRIMARY KEY (id)
);


When I use the IntelliJ SQL console and execute it there, everything works fine. But when I try to execute it via PreparedStatement then it shows an error in the console..
String sql = "See SQL above";
PreparedStatement stm = getConnection().prepareStatement(sql);
stm.executeUpdate();
stm.close();


Error
Caused by: java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: (conn=943) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS friendsystemSettings (
                           ...' at line 8
        at de.tomasgng.b..
Was this page helpful?