Ini akan bekerja dalam kasus Anda:
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 )" ) ;
Penyebab:Pernyataan hanya dapat mengeksekusi satu Pernyataan SQL dengan setiap panggilan metode eksekusi.
Jika Anda ingin menjalankan dua atau lebih pernyataan secara bersamaan, Anda dapat melakukannya dengan Batch-Jobs.
Seperti:
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();