To change data (perform an
) you use the
method. This method is similar to the method
used to issue a
statement, but it doesn't return a
it returns the number of rows affected by the
Example 5.3, "Deleting Rows in JDBC"
illustrates the usage.
This example will issue a simple
statement and print out the number of
int foovalue = 500; PreparedStatement st = conn.prepareStatement("DELETE FROM mytable WHERE columnfoo = ?"); st.setInt(1, foovalue); int rowsDeleted = st.executeUpdate(); System.out.println(rowsDeleted + " rows deleted"); st.close();