OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Connector/J

V2.4.14
  • What is OceanBase Connector J?
    • Overview of OceanBase Connector/J
    • Compatibility requirements
    • Limitations
  • Install Driver
    • Install and load OceanBase Connector/J
  • Instructions
    • Quick start
      • Import packages
      • Establish a database connection
      • Create a Statement object
      • Run queries and retrieve ResultSet objects
      • Process ResultSet objects
      • Close ResultSet and Statement objects
      • Manage tables and data
      • Commit changes
      • Close a database connection
      • Examples
    • Data sources and URL
      • Data source overview
      • Database URL
    • Java data streams
      • Overview of Java data streams
      • LONG and LONG RAW data types
      • Use LOBs
        • Overview of LOB data types
        • LOB data interface
        • LOB locator interface
      • CHAR, VARCHAR, and RAW data types
    • Statement caching
      • Overview of statement caching
      • Use statement caching
      • Reuse statement objects
    • Call a stored procedure
    • Handle SQL exceptions
    • Result set
      • Overview of result sets
      • Limitations
      • FetchSize
      • refreshRow
      • useCursorFetch
    • Batch processing
    • Failover and Load-Balancing
      • Failover and load balancing modes
      • LoadBalance strategies
      • Load balancing strategy configuration methods
    • Rich client
    • Logging
    • Network overheads
    • Show Trace
    • Security features
    • Troubleshooting
  • Reference
    • Features specific to the Oracle mode
      • Binary Protocol (Prepared Statements)
        • COM_STMT_PREPARE_EXECUTE
        • COM_STMT_SEND_PIECE_DATA
      • Call PL stored procedures
      • Scrollability of a result set
      • Use ARRAY and STRUCT classes
      • Distributed transactions
        • Overview
        • XA components
        • Distributed transaction examples
      • Obtain remarks
      • Data types supported in Oracle mode
      • Error messages in Oracle mode
    • Supported SQL and PL data types
    • Common APIs
      • Overview
      • java.sql.Connection
      • java.sql.CallableStatement
      • java.sql.DatabaseMetaData
      • java.sql.Driver
      • java.sql.PreparedStatement
      • java.sql.ParameterMetaData
      • java.sql.ResultSet
      • java.sql.ResultSetMetaData
      • java.sql.Statement
      • javax.sql.ConnectionPoolDataSource
      • javax.naming.Context
      • javax.sql.PooledConnection
      • com.oceanbase.jdbc.ObPrepareStatement
  • Release Notes
    • V2.4
      • OceanBase Connector/J V2.4.14
      • OceanBase Connector/J V2.4.13
      • OceanBase Connector/J V2.4.12
      • OceanBase Connector/J V2.4.11
      • OceanBase Connector/J V2.4.8
      • OceanBase Connector/J V2.4.5
      • OceanBase Connector/J V2.4.4
      • OceanBase Connector/J V2.4.3
      • OceanBase Connector/J V2.4.2
      • OceanBase Connector/J V2.4.1
      • OceanBase Connector/J V2.4.0
    • V2.2
      • OceanBase Connector/J V2.2.11
      • OceanBase Connector/J V2.2.10
      • OceanBase Connector/J V2.2.7
      • OceanBase Connector/J V2.2.6
      • OceanBase Connector/J V2.2.3
      • OceanBase Connector/J V2.2.0

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Connector/J
  3. V2.4.14

java.sql.Statement

Last Updated:2026-09-04 08:24:26

Description
Methods

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
Description
Supported in Oracle mode
Supported in MySQL mode
executeQuery(String sql) ResultSet Executes an SQL query that returns a single ResultSet object. Yes Yes
executeUpdate(String sql) int Executes an INSERT, UPDATE, or DELETE statement and returns the number of affected rows. Yes Yes
close() void Closes a Statement object and releases its resources. Yes Yes
getMaxFieldSize() int Obtains the maximum column size of a result set. Yes Yes
setMaxFieldSize(int max) void Sets the maximum column size of a result set. Yes Yes
getMaxRows() int Obtains the maximum number of rows that can be contained in any ResultSet object produced by a Statement object. Yes Yes
setMaxRows(int max) void Sets the maximum number of rows that can be contained in any ResultSet object produced by a Statement object. Yes. This parameter takes effect in OceanBase Connector/J V2.4.11 and later. Yes
setEscapeProcessing(boolean enable) void Specifies whether to enable SQL escape processing. Yes Yes
getQueryTimeout() int Obtains the query timeout period, in seconds. Yes Yes
setQueryTimeout(int seconds) void Sets the query timeout period, in seconds. Yes Yes
cancel() void Cancels the current execution of a Statement object. Yes Yes
getWarnings() SQLWarning Obtains the warnings generated during the execution of a Statement object. Yes Yes
clearWarnings() void Clears all warnings generated on a Statement object. Yes Yes
setCursorName(String name) void Sets the cursor name of a ResultSet object. This method is not supported in either MySQL or Oracle mode. No No
getResultSet() ResultSet Obtains the current ResultSet object. Yes Yes
getUpdateCount() int Obtains the number of rows affected by an update operation. Yes Yes
getMoreResults() Boolean Moves to the next result. Yes Yes
setFetchDirection(int direction) void Sets the fetch direction of a ResultSet object. This method is not supported in either MySQL or Oracle mode. No No
getFetchDirection() int Obtains the fetch direction of a ResultSet object. Yes Yes
setFetchSize(int rows) void Sets the fetch size (number of rows) of a Statement object. Yes Yes
getFetchSize() int Obtains the fetch size of a Statement object. Yes Yes
getResultSetConcurrency() int Obtains the concurrency mode of a ResultSet object. Yes Yes
getResultSetType() int Obtains the type of a ResultSet object. Yes Yes
addBatch(String sql) void Adds an SQL command to the list of commands that will be executed as a batch. Yes Yes
clearBatch() void Clears the list of commands that will be executed as a batch. Yes Yes
executeBatch() int[] Executes a batch of commands and returns an array of update counts. Yes Yes
getConnection() Connection Obtains the Connection object that produced this Statement object. Yes Yes
getGeneratedKeys() ResultSet Obtains the auto-generated keys created after an INSERT statement is executed. If the configuration compatibleOjdbcVersion=8&useArrayBinding=true&useOraclePrepareExecute=true is specified in Oracle mode, the RETURNING...INTO.. clause can be used to implement the getGeneratedKeys() method for obtaining the batch operation result set. Yes Yes
execute(String sql, int autoGeneratedKeys) Boolean Executes a given SQL statement, and instructs the driver whether to make any auto-generated keys available for retrieval. Yes Yes
execute(String sql, int columnIndexes[]) Boolean Executes a given SQL statement, and instructs the driver whether to make only the auto-generated keys corresponding to columns specified in the columnIndexes[] array available for retrieval. Yes Yes
execute(String sql, String columnNames[]) Boolean Executes the given SQL statement, and instructs the driver whether to make only the auto-generated keys corresponding to columns specified in the columnNames[] array available for retrieval. Yes Yes
getResultSetHoldability() int Obtains the holdability of a ResultSet object. Yes Yes
isClosed() Boolean Verifies whether a Statement object has been closed. Yes Yes
setPoolable(boolean poolable) void Specifies whether the application can pool a Statement object. No No
isPoolable() Boolean Verifies whether a Statement object is poolable. Yes Yes
closeOnCompletion() void Specifies to close a Statement object when all its dependent ResultSet objects are closed. Yes Yes
isCloseOnCompletion() Boolean Verifies whether a Statement object will be closed when all its dependent ResultSet objects are closed. Yes Yes
getLargeUpdateCount() long Obtains the number of rows affected by an update operation. This method is used when the returned row count is large. Yes Yes
setLargeMaxRows(long max) void Sets the maximum number of rows that can be contained in any ResultSet object produced by a Statement object. This method is used when the row limit is large. Yes Yes
getLargeMaxRows() long Obtains the maximum number of rows that can be contained in any ResultSet object produced by a Statement object. This method is used when the returned row limit is large. Yes Yes
executeLargeBatch() long[] Executes a batch of commands and returns an array of update counts. This method is used when the returned row count is large. Yes Yes
executeLargeUpdate(String sql) long Executes a given SQL statement. This method is applicable to update operations and is used when the returned row count is large. Yes Yes
executeLargeUpdate(String sql, int autoGeneratedKeys) long Executes a given SQL statement and instructs the driver whether to make any auto-generated keys available for retrieval. This method is used when the returned row count is large. Yes Yes
executeLargeUpdate(String sql, int columnIndexes[]) long Executes a given SQL statement and instructs the driver whether to make only the auto-generated keys corresponding to the columns specified in the columnIndexes[] array available for retrieval. This method is used when the returned row count is large. Yes Yes
executeLargeUpdate(String sql,String columnNames[]) long Executes a given SQL statement and instructs the driver whether to make only the auto-generated keys corresponding to the columns specified in the columnNames[] array available for retrieval. This method is used when the returned row count is large. Yes Yes

Previous topic

java.sql.ResultSetMetaData
Last

Next topic

javax.sql.ConnectionPoolDataSource
Next
on this page
Description
Methods