I use this query:
CREATE TABLE ? ( ListName VARCHAR(200) NOT NULL, MovieID INT NOT NULL, Watched VARCHAR(10) NOT NULL, UserComment VARCHAR(1000) NOT NULL);
with the parameter added later.
In DataGrip for example, or directly in phpmyadmin this works fine.
This is the error i'm getting:
MySQLSyntaxErrorException: 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 ''username_movielist' ( ListName VARCHAR(200) NOT NULL, MovieID INT NOT NULL, Wat' at line 1
What am I doing wrong here?
This is the code I use:
String tableName = usernameInput.getText().concat("_movielist");
PreparedStatement movieQueryStatement = Main.getConnection().prepareStatement(QueryManager.USERNAME_MOVIE_TABLE);
movieQueryStatement.setString(1, tableName);
movieQueryStatement.executeUpdate();