Are you an LLM? You can read better optimized documentation at /en/docs/7.0.0/ograc/developer_guide/jdbc/java_sql_statement.md for this page in Markdown format
java.sql.Statement
java.sql.Statement is the SQL statement interface.
Table 1 Support for java.sql.Statement
Method Name | Return Value Type | JDBC 4 Supported |
|---|
addBatch(String sql) | void | Yes |
clearBatch() | void | Yes |
close() | void | Yes |
execute(String sql) | Boolean | Yes |
execute(String sql, int autoGeneratedKeys) | Boolean | Yes |
execute(String sql, int[] columnIndexes) | Boolean | Yes |
execute(String sql, String[] columnNames) | Boolean | Yes |
executeBatch() | Boolean | Yes |
executeQuery(String sql) | ResultSet | Yes |
executeUpdate(String sql) | int | Yes |
executeUpdate(String sql, int autoGeneratedKeys) | int | Yes |
executeUpdate(String sql, int[] columnIndexes) | int | Yes |
executeUpdate(String sql, String[] columnNames) | int | Yes |
getConnection() | Connection | Yes |
getFetchSize() | int | Yes |
getGeneratedKeys() | ResultSet | Yes |
getMaxFieldSize() | int | Yes |
getMaxRows() | int | Yes |
getMoreResults() | boolean | Yes |
getMoreResults(int current) | boolean | Yes |
getResultSet() | ResultSet | Yes |
getResultSetConcurrency() | int | Yes |
getResultSetHoldability() | int | Yes |
getResultSetType() | int | Yes |
getQueryTimeout() | int | Yes |
getUpdateCount() | int | Yes |
getWarnings() | SQLWarning | Yes |
isClosed() | Boolean | Yes |
isCloseOnCompletion() | Boolean | Yes |
isPoolable() | Boolean | Yes |
setMaxFieldSize(int max) | void | Yes |
setMaxRows(int max) | void | Yes |
setQueryTimeout(int seconds) | void | Yes |
setFetchSize(int rows) | void | Yes |
cancel() | void | Yes |
executeLargeUpdate(String sql) | long | No |
getLargeUpdateCount() | long | No |
executeLargeBatch() | long | No |
executeLargeUpdate(String sql, int autoGeneratedKeys) | long | No |
executeLargeUpdate(String sql, int[] columnIndexes) | long | No |
executeLargeUpdate(String sql, String[] columnNames) | long | No |
NOTE
- Using setFetchSize can reduce the memory usage of a result set on the client. It packages the result set into a cursor and processes it in segments, which increases the communication traffic between the database and client and incurs performance overhead.
- Since database cursors are valid only within a transaction, when setting setFetchSize, you need to set the connection to non-auto-commit mode, that is, set
setAutoCommit to false. At the same time, when service data needs to be persisted to the database, perform a commit operation on the connection. - LargeUpdate-related methods must be used with JDBC 4.2 or later.