Executes the given SQL statement and signals the driver with the
given flag about whether the
auto-generated keys produced by this Statement
object
should be made available for retrieval. The driver will ignore the
flag if the SQL statement
is not an INSERT
statement, or an SQL statement able to return
auto-generated keys (the list of such statements is vendor-specific).
Note:This method cannot be called on a
PreparedStatement
or CallableStatement
.
sql | an SQL Data Manipulation Language (DML) statement, such as INSERT , UPDATE or
DELETE ; or an SQL statement that returns nothing,
such as a DDL statement. | |
autoGeneratedKeys | a flag indicating whether auto-generated keys
should be made available for retrieval;
one of the following constants:
Statement.RETURN_GENERATED_KEYS
Statement.NO_GENERATED_KEYS |
SQLException | if a database access error occurs,
this method is called on a closed Statement , the given
SQL statement returns a ResultSet object,
the given constant is not one of those allowed, the method is called on a
PreparedStatement or CallableStatement | |
SQLFeatureNotSupportedException | if the JDBC driver does not support this method with a constant of Statement.RETURN_GENERATED_KEYS | |
SQLTimeoutException | when the driver has determined that the
timeout value that was specified by the setQueryTimeout
method has been exceeded and has at least attempted to cancel
the currently running Statement |
Diagram: Statement