Executing Statements

The Statement interface provides two methods for executing the statement. The executeQuery() method is used to execute statements, which have been created by using a SELECT command. The executeQuery() method returns a ResultSet object that contains the resulting rows of a query.

The executeUpdate() method is used to execute statements that have been created by using a DML command. The executeUpdate() method returns the number of rows that were successfully processed. If the wrong method is used to execute a statement, an error is returned. For information about the current DML commands supported, see Modifying Data in a Table.