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.2.10
  • What is OceanBase Connector J?
    • What's New
    • Compatibility requirements
    • Overview of OceanBase Connector/J
  • Install Driver
    • Install and load the OceanBase Connector/J driver
  • Instructions
    • Quick start
      • Import packages
      • Create 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
      • Example
    • Data sources and URL
      • Data source overview
      • Data source characteristics and properties
      • Create and connect to a data source instance
      • 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 API
      • CHAR, VARCHAR, and RAW data types
    • Statement caching
      • Overview of statement caching
      • Use statement caching
      • Reuse statement objects
    • Use CallableStatements to call stored procedures
    • Handle SQL exceptions
    • Result set
      • Overview of result sets
      • Limits
      • FetchSize
      • refreshRow
      • useCursorFetch
    • Batch processing
    • Failover and load balancing modes
    • Security features
    • SQL NetworkCostInfo
    • 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
      • Result set performance
      • Use ARRAY and STRUCT classes
      • Distributed transactions
        • Overview of distributed transactions
        • XA components
        • Distributed transaction examples
      • Error messages in Oracle mode
      • Data types supported in Oracle mode
    • Supported SQL and PL data types
    • Common APIs
      • Overview of common APIs
      • 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
  • Release Notes
    • V2.2
      • OceanBase Connector/J V2.2.10
      • OceanBase Connector/J V2.2.0

Download PDF

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

java.sql.ResultSet

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

Description
Methods

java.sql.ResultSet is an interface for executing result sets.

Description

java.sql.ResultSet generates a data table that represents a database result set, usually by executing a statement that queries the database.

A ResultSet object maintains a cursor that points to a specific data row. The cursor is initially located before the first row. After the next method is called, the cursor is moved to the next row. If no more rows exist in the ResultSet object, false is returned. Therefore, the next method can be used in a while loop to traverse the corresponding ResultSet object.

A default ResultSet object cannot be updated and has a cursor that moves only in a forward direction. In this case, you can traverse the result set only once from the first row to the last row. However, a scrollable or updatable ResultSet object will be generated. As shown in the following example, con is a valid Connection object.

Statement st = con.createStatement(
                                      ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
       ResultSet rs = stmt.executeQuery("SELECT a, b FROM TAB1");
       // rs will be scrollable and updatable but will not show changes made by others.

The ResultSet interface provides getter methods such as getBoolean and getLong that can be used to retrieve column values from the current row. Values can be retrieved by using column indexes or column names. We recommend that you use column indexes. Column indexes can be used to retrieve values in a more efficient manner than column names. Column indexes are numbered starting from 1. To achieve maximum portability, the result set columns in each row must be read from left to right, and each column must be read only once.

When the JDBC driver calls a getter method, the JDBC driver attempts to convert the underlying data into the Java type specified in the getter method and returns valid Java values.

Column names used as the input of getter methods are case-insensitive. If a getter method is called by using column names and several columns have the same name, the value of the first matching column is returned. If column names are used in the SQL statement that generated the result set, you can use the column name option. For columns that are not explicitly named in the query, we recommend that you use column numbers. If column names are used, the developer can use the AS clause to ensure that each name is referenced by only one column.

Methods

Method
Return type
JDBC 4 supported in Oracle mode
JDBC 4 supported in MySQL mode
getString(int parameterIndex) String Yes Yes
getString(String parameterName) String Yes Yes
getInt(int parameterIndex) int Yes Yes
getInt(String parameterName) int Yes Yes
getLong(int parameterIndex) long Yes Yes
getLong(String parameterName) long Yes Yes
getFloat(int parameterIndex) float Yes Yes
getFloat(String parameterName) float Yes Yes
getDouble(int parameterIndex) double Yes Yes
getDouble(String parameterName) double Yes Yes
getBigDecimal(int parameterIndex) BigDecimal Yes Yes
getBigDecimal(String parameterName) BigDecimal Yes Yes
getBytes(int parameterIndex) byte[] Yes Yes
getBytes(String parameterName) byte[] Yes Yes
getDate(int parameterIndex) Date Yes Yes
getDate(String parameterName) Date Yes Yes
getTime(int parameterIndex) Time Yes Yes
getTime(String parameterName) Time Yes Yes
getTimestamp(int parameterIndex) Timestamp Yes Yes
getTimestamp(String parameterName) Timestamp Yes Yes
getBlob(int parameterIndex) Blob Yes Yes
getBlob(String parameterName) Blob Yes Yes
getClob(int parameterIndex) Clob Yes Yes
getClob(String parameterName) Clob Yes Yes
getMetaData() ResultSetMetaData Yes Yes
getRowId(int columnIndex) void No No
getRowId(String columnLabel) RowId No No
updateRowId(int columnIndex,RowId x) void No No
updateRowId(String columnLabel,RowId x) void No No
getHoldability() void Yes Yes
isClosed() Boolean Yes Yes
updateNString(int columnIndex,String nString) void Yes Yes
updateNString(String columnLabel,String nString) void Yes Yes
updateNClob(int columnIndex,NClob nClob) void Yes Yes
updateNClob(String columnLabel,NClob nClob) void Yes Yes
getNClob(int columnIndex) NClob Yes Yes
getNClob(String columnLabel) NClob Yes Yes
getSQLXML(int columnIndex) SQLXML No No
getSQLXML(String columnLabel) SQLXML No No
updateSQLXML(int columnIndex,SQLXML xmlObject) void No No
updateSQLXML(String columnLabel,SQLXML xmlObject) void No No
getNString(int columnIndex) String Yes Yes
getNString(String columnLabel) String Yes Yes
getNCharacterStream(int columnIndex) Reader Yes Yes
getNCharacterStream(String columnLabel) Reader Yes Yes
updateNCharacterStream(int columnIndex,java.io.Reader x,long length) void Yes Yes
updateNCharacterStream(String columnLabel,java.io.Reader reader, long length) void Yes Yes
updateAsciiStream(int columnIndex,java.io.InputStream x,long length) void Yes Yes
updateAsciiStream(String columnLabel,java.io.InputStream x, long length) void Yes Yes
updateBinaryStream(int columnIndex,java.io.InputStream x,long length) void Yes Yes
updateBinaryStream(String columnLabel,java.io.InputStream x,long length) void Yes Yes
updateCharacterStream(String columnLabel,java.io.Reader reader, long length) void Yes Yes
updateCharacterStream(int columnIndex,java.io.Reader x, int length) void Yes Yes
updateCharacterStream(String columnLabel,java.io.Reader reader,int length) void Yes Yes
updateCharacterStream(int columnIndex,java.io.Reader x,long length) void Yes Yes
updateCharacterStream(int columnIndex,java.io.Reader x) void Yes Yes
updateCharacterStream(String columnLabel,java.io.Reader reader) void Yes Yes
updateBlob(int columnIndex,InputStream inputStream) void Yes Yes
updateBlob(String columnLabel,InputStream inputStream) void Yes Yes
updateClob(int columnIndex,Reader reader) void Yes Yes
updateClob(String columnLabel,Reader reader) void Yes Yes
updateNClob(int columnIndex,Reader reader) void Yes Yes
updateNClob(String columnLabel,Reader reader) void Yes Yes
getObject(int columnIndex,Class<T> type) <T> Yes Yes
getObject(String columnLabel,Class<T> type) <T> Yes Yes
updateObject(int columnIndex,Object x,SQLType targetSqlType, int scaleOrLength) void No No
updateObject(String columnLabel,Object x,SQLType targetSqlType, int scaleOrLength) void No No
updateObject(int columnIndex,Object x,SQLType targetSqlType) void No No
updateObject(String columnLabel,Object x,SQLType targetSqlType) void No No

Previous topic

java.sql.ParameterMetaData
Last

Next topic

java.sql.ResultSetMetaData
Next
on this page
Description
Methods