i want to create a new mySQL table with this method. Database connection is working perfectly. I made many working statements like this, but this one, with creating a table isnt working. So the mistake has to be in this few lines of code. On the botton i added the error message.
public void createNewTable(){
DatabaseConnection connectNow = new DatabaseConnection();
Connection connectDb = connectNow.getConnection();
String tableName = "users";
try {
String createTable = "CREATE TABLE ? (firstname varchar(30), lastname varchar(30), tel integer" +
"email varchar(40), arrive_stamp timestamp, quit_stamp timestamp)";
PreparedStatement myStmt = connectDb.prepareStatement(createTable);
myStmt.setString(1, tableName);
myStmt.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
e.getCause();
}
}
Illegal operation on empty result set.
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near ''users' (firstname varchar(30),
lastname varchar(30), tel integer, email varchar' at line 1