阅读表名后,您将必须格式化字符串,例如:
static String queryCreateTable = "CREATE TABLE {0}" +"(ID INTEGER not NULL ," +"BRAND VARCHAr(40)," +"MODEL VARCHAr(40)," +"YEAR INTEGER not NULL," +"NOVELTY BINARY," +"PRIMARY KEY ( ID ))";然后创建像:
newNameOfTable = JOptionPane.showInputDialog("Connected for saving data. " + "Input name of new table:");statement = connection.createStatement();statement.execute(MessageFormat.format(queryCreateTable, newNameOfTable));


