Help Center > > Developer Guide> Tutorial: Development Using JDBC or ODBC> JDBC Interface Reference> java.sql.Statement

java.sql.Statement

Updated at: Jul 15, 2020 GMT+08:00

This section describes java.sql.Statement, the interface for executing SQL statements.

Table 1 Support status for java.sql.Statement

Method Name

Return Type

Support JDBC 4

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

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 transaction. If setFetchSize is set, set setAutoCommit(false) and commit transactions on the connection to flush service data to a database.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel