这应该在您的情况下有效:
statement.executeUpdate("DROP TABLE IF EXISTS account ");statement.executeUpdate("CREATE TABLE account ( " +"accountNum INT( 11 )," +"dateCreated DATE NOT NULL," +"accountName TEXT," +"description TEXT," +"statusAccount TEXT," +"sumOfMoney INT( 11 ) NOT NULL DEFAULT 0 )" ) ;
原因:每次调用execute方法时,语句只能执行一个SQL语句。
如果要同时执行两个或多个语句,则可以使用Batch-Jobs来执行。
喜欢:
statement.addBatch("DROP TABLE IF EXISTS account ");statement.addBatch("CREATE TABLE account ( " +"accountNum INT( 11 )," +"dateCreated DATE NOT NULL," +"accountName TEXT," +"description TEXT," +"statusAccount TEXT," +"sumOfMoney INT( 11 ) NOT NULL DEFAULT 0 )" ) ;statement.executeBatch();
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)