Creating and Modifying Database Objects
To create, modify or drop a database object like a table or view you use the
execute()
method. This method is similar to the method
executeQuery()
, but
it doesn’t return a result.
Example 5.4, "Dropping a Table in JDBC
illustrates the usage.
Example 5.4. Dropping a Table in JDBC
This example will drop a table.
Statement st = conn.createStatement();
st.execute("DROP TABLE mytable");
st.close();