TomasGnG 😴
TomasGnG 😴
Explore posts from servers
JCHJava Community | Help. Code. Learn.
Created by TomasGnG 😴 on 10/19/2024 in #java-help
SQLite driver not found with OrmLite
No description
21 replies
JCHJava Community | Help. Code. Learn.
Created by TomasGnG 😴 on 9/22/2024 in #java-help
Download a file with its given name
Normally if you want to download a file through your browser, the browser asks you for the destination path and the name of the file is already given. Now I want to download a file with that specific filename. How can I do that?
26 replies
JCHJava Community | Help. Code. Learn.
Created by TomasGnG 😴 on 3/21/2024 in #java-help
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)
);
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();
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..
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..
17 replies