java.sql.Statement is an SQL statement interface.
Description
java.sql.Statement is used for executing a static SQL statement and returning the execution results.
By default, only one ResultSet object can be opened for each Statement object at a given time. Therefore, only ResultSet objects generated by different statement objects can be read in an interleaved manner. If an open ResultSet object exists, all execution methods in the Statement interface implicitly close the current ResultSet object of the statement.
Methods
| Method | Return type | Supported in Oracle mode? | Supported in MySQL mode? |
|---|---|---|---|
| executeQuery(String sql) | ResultSet | Yes | Yes |
| executeUpdate(String sql) | int | Yes | Yes |
| close() | void | Yes | Yes |
| getMaxFieldSize() | int | Yes | Yes |
| setMaxFieldSize(int max) | void | Yes | Yes |
| getMaxRows() | int | Yes | Yes |
| setMaxRows(int max) | void | Yes | Yes |
| setEscapeProcessing(boolean enable) | void | Yes | Yes |
| getQueryTimeout() | int | Yes | Yes |
| setQueryTimeout(int seconds) | void | Yes | Yes |
| cancel() | void | Yes | Yes |
| getWarnings() | SQLWarning | Yes | Yes |
| clearWarnings() | void | Yes | Yes |
| setCursorName(String name) | void | No | No |
| getResultSet() | ResultSet | Yes | Yes |
| getUpdateCount() | int | Yes | Yes |
| getMoreResults() | Boolean | Yes | Yes |
| setFetchDirection(int direction) | void | No | No |
| getFetchDirection() | int | Yes | Yes |
| setFetchSize(int rows) | void | Yes | Yes |
| getFetchSize() | int | Yes | Yes |
| getResultSetConcurrency() | int | Yes | Yes |
| getResultSetType() | int | Yes | Yes |
| addBatch(String sql) | void | Yes | Yes |
| clearBatch() | void | Yes | Yes |
| executeBatch() | int[] | Yes | Yes |
| getConnection() | Connection | Yes | Yes |
| getGeneratedKeys() | ResultSet | Yes | Yes |
| execute(String sql, int autoGeneratedKeys) | Boolean | Yes | Yes |
| execute(String sql, intcolumnIndexes[]) | Boolean | Yes | Yes |
| execute(String sql,String columnNames[]) | Boolean | Yes | Yes |
| getResultSetHoldability() | int | Yes | Yes |
| isClosed() | Boolean | Yes | Yes |
| setPoolable(boolean poolable) | void | No | No |
| isPoolable() | Boolean | Yes | Yes |
| closeOnCompletion() | void | Yes | Yes |
| isCloseOnCompletion() | Boolean | Yes | Yes |
| getLargeUpdateCount() | long | Yes | Yes |
| setLargeMaxRows(long max) | void | Yes | Yes |
| getLargeMaxRows() | long | Yes | Yes |
| executeLargeBatch() | long[] | Yes | Yes |
| executeLargeUpdate(String sql) | long | Yes | Yes |
| executeLargeUpdate(String sql, int autoGeneratedKeys) | long | Yes | Yes |
| executeLargeUpdate(String sql, int columnIndexes[]) | long | Yes | Yes |
| executeLargeUpdate(String sql,String columnNames[]) | long | Yes | Yes |