我想动态地在mysql中创建表并使用提供的电子邮件地址用户分配它们的名称。但是,每当我尝试动态分配表名时,它都会显示错误,我不知道其他方式来满足我的要求。如何在mysql服务器中动态分配表名
这里是我写
String TableName = Email.getText();
try {
String myTableName = "CREATE TABLE '" + TableName + "' "
+ "(id INTEGER not NULL, "
+ " first VARCHAR(255), "
+ " last VARCHAR(255), "
+ " age INTEGER, "
+ " PRIMARY KEY (id))";;
Class.forName(m.RegisterationString);
java.sql.Connection con;
con = DriverManager.getConnection(m.URL, m.UserName, m.Password);
Statement State = con.createStatement();
//This line has the issue
State.executeUpdate(myTableName);
System.out.println("Table Created");
}
什么是错误? –