java.sql.Statement
This section describes java.sql.Statement, the interface for executing SQL statements.
Method Name |
Return Type |
JDBC4 Supported or Not |
---|---|---|
addBatch(String sql) |
void |
Yes |
clearBatch() |
void |
Yes |
clearWarnings() |
void |
Yes |
close() |
void |
Yes |
closeOnCompletion() |
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 |
getFetchDirection() |
int |
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 |
setCursorName(String name) |
void |
Yes |
setEscapeProcessing(boolean enable) |
void |
Yes |
setFetchDirection(int direction) |
void |
Yes |
setMaxFieldSize(int max) |
void |
Yes |
setMaxRows(int max) |
void |
Yes |
setPoolable(boolean poolable) |
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 |
enableStreamingResults() |
void |
Yes |
- Using setFetchSize can reduce the memory occupied by result sets on the client. Result sets are packaged into cursors and segmented for processing, which will increase the communication traffic between the database and the client, affecting performance.
- Database cursors are valid only within their transactions. If setFetchSize is set, set setAutoCommit(false) and commit transactions on the connection to flush service data to a database.
- The LargeUpdate method can only be used in JDBC 4.2 or later.
- enableStreamingResults() is a customized API for enabling streaming read. This API indirectly calls setFetchSize(Integer.MIN_VALUE). To enable the streaming read function, set enableStreamingQuery in the URL to true and call setFetchSize(Integer.MIN_VALUE) or enableStreamingResults(). Except that the streaming read function is enabled, the input parameter of setFetchSize() can only be a positive number or 0.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot