executeUpdate
int executeUpdate(java.lang.String sql,
java.lang.String[] columnNames)
throws SQLException
- Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the names of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array 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 .
-
-
-
Parameters:
-
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.
-
columnNames - an array of the names of the columns that should be returned from the inserted row
-
Returns:
- either the row count for
INSERT , UPDATE , or DELETE statements, or 0 for SQL statements that return nothing
-
Throws:
-
SQLException - if a database access error occurs, this method is called on a closed Statement , the SQL statement returns a ResultSet object, the second argument supplied to this method is not a String array whose elements are valid column names, the method is called on a PreparedStatement or CallableStatement
-
SQLFeatureNotSupportedException - if the JDBC driver does not support this method
-
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
-
Since:
- 1.4
|