要創建,更改或者刪除一個類似表或者視圖這樣的數據庫對象, 你要使用 execute() 方法。 這個方法類似于 executeQuery(),不過它不返回結果。 Example 31-7 演示了它的用法。
Example 31-7. 在 JDBC 裡刪除表
這個例子刪除一個表。
Statement st = db.createStatement(); st.execute("DROP TABLE mytable"); st.close();