java.sql.Statement
java.sql.Statement is the SQL statement interface.
Method |
Return Type |
JDBC 4 Support |
---|---|---|
close() |
void |
Yes |
execute(String sql) |
Boolean |
Yes |
executeQuery(String sql) |
ResultSet |
Yes |
executeUpdate(String sql) |
int |
Yes |
getConnection() |
Connection |
Yes |
getResultSet() |
ResultSet |
Yes |
getQueryTimeout() |
int |
Yes |
getUpdateCount() |
int |
Yes |
isClosed() |
Boolean |
Yes |
setQueryTimeout(int seconds) |
void |
Yes |
setFetchSize(int rows) |
void |
Yes |
cancel() |
void |
Yes |

By using setFetchSize, you can reduce the memory usage of the result set on the client. The principle behind this is that the result set is packaged into a cursor and then processed in segments, which increases the communication between the database and the client, leading to some performance overhead.
Since database cursors are valid within a transaction, when setting setFetchSize, you need to configure the connection to non-auto-commit mode by calling setAutoCommit(false). Additionally, when service data needs to be persisted to the database, a commit operation should be executed on the connection.
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