Statement

public interface Statement implements Wrapper AutoCloseable
Known Indirect Subclasses

The object used for executing a static SQL statement and returning the results it produces.

By default, only one ResultSet object per Statement object can be open at the same time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All execution methods in the Statement interface implicitly close a statment's current ResultSet object if an open one exists.

Constant Summary

int CLOSE_ALL_RESULTS The constant indicating that all ResultSet objects that have previously been kept open should be closed when calling getMoreResults.
int CLOSE_CURRENT_RESULT The constant indicating that the current ResultSet object should be closed when calling getMoreResults.
int EXECUTE_FAILED The constant indicating that an error occured while executing a batch statement.
int KEEP_CURRENT_RESULT The constant indicating that the current ResultSet object should not be closed when calling getMoreResults.
int NO_GENERATED_KEYS The constant indicating that generated keys should not be made available for retrieval.
int RETURN_GENERATED_KEYS The constant indicating that generated keys should be made available for retrieval.
int SUCCESS_NO_INFO The constant indicating that a batch statement executed successfully but that no count of the number of rows it affected is available.

Public Method Summary

abstract void
addBatch(String sql)
Adds the given SQL command to the current list of commmands for this Statement object.
abstract void
cancel()
Cancels this Statement object if both the DBMS and driver support aborting an SQL statement.
abstract void
clearBatch()
Empties this Statement object's current list of SQL commands.
abstract void
clearWarnings()
Clears all the warnings reported on this Statement object.
abstract void
close()
Releases this Statement object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.
abstract boolean
execute(String sql, int autoGeneratedKeys)
Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval.
abstract boolean
execute(String sql)
Executes the given SQL statement, which may return multiple results.
abstract boolean
execute(String sql, int[] columnIndexes)
Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
abstract boolean
execute(String sql, String[] columnNames)
Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
abstract int[]
executeBatch()
Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.
abstract ResultSet
executeQuery(String sql)
Executes the given SQL statement, which returns a single ResultSet object.
abstract int
executeUpdate(String sql)
Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement.
abstract int
executeUpdate(String sql, String[] columnNames)
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.
abstract int
executeUpdate(String sql, int[] columnIndexes)
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.
abstract int
executeUpdate(String sql, int autoGeneratedKeys)
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.
abstract Connection
getConnection()
Retrieves the Connection object that produced this Statement object.
abstract int
getFetchDirection()
Retrieves the direction for fetching rows from database tables that is the default for result sets generated from this Statement object.
abstract int
getFetchSize()
Retrieves the number of result set rows that is the default fetch size for ResultSet objects generated from this Statement object.
abstract ResultSet
getGeneratedKeys()
Retrieves any auto-generated keys created as a result of executing this Statement object.
abstract int
getMaxFieldSize()
Retrieves the maximum number of bytes that can be returned for character and binary column values in a ResultSet object produced by this Statement object.
abstract int
getMaxRows()
Retrieves the maximum number of rows that a ResultSet object produced by this Statement object can contain.
abstract boolean
getMoreResults(int current)
Moves to this Statement object's next result, deals with any current ResultSet object(s) according to the instructions specified by the given flag, and returns true if the next result is a ResultSet object.
abstract boolean
getMoreResults()
Moves to this Statement object's next result, returns true if it is a ResultSet object, and implicitly closes any current ResultSet object(s) obtained with the method getResultSet.
abstract int
getQueryTimeout()
Retrieves the number of seconds the driver will wait for a Statement object to execute.
abstract ResultSet
getResultSet()
Retrieves the current result as a ResultSet object.
abstract int
getResultSetConcurrency()
Retrieves the result set concurrency for ResultSet objects generated by this Statement object.
abstract int
getResultSetHoldability()
Retrieves the result set holdability for ResultSet objects generated by this Statement object.
abstract int
getResultSetType()
Retrieves the result set type for ResultSet objects generated by this Statement object.
abstract int
getUpdateCount()
Retrieves the current result as an update count; if the result is a ResultSet object or there are no more results, -1 is returned.
abstract SQLWarning
getWarnings()
Retrieves the first warning reported by calls on this Statement object.
abstract boolean
isClosed()
Retrieves whether this Statement object has been closed.
abstract boolean
isPoolable()
Returns a value indicating whether the Statement