OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Connector/J

V2.4.5

  • What is OceanBase Connector J?
    • Overview of OceanBase Connector/J
    • Compatibility requirements
  • 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
      • 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 comments
      • 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.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

Overview of OceanBase Connector/J Compatibility requirements Install and load the OceanBase Connector/J driver 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 Examples Data source overviewDatabase URL Overview of Java data streams LONG and LONG RAW data types CHAR, VARCHAR, and RAW data types Overview of statement caching Use statement caching Reuse statement objects Call a stored procedure Handle SQL exceptions Overview of result sets Limitations FetchSize refreshRow useCursorFetch Batch processing Failover and load balancing modes LoadBalance strategies Load balancing strategy configuration methods Rich client Logging Network overheads Show Trace Security features Troubleshooting Call PL stored procedures Scrollability of a result set Use ARRAY and STRUCT classes Obtain comments Data types supported in Oracle mode Error messages in Oracle mode Supported SQL and PL data types 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 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 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
OceanBase logo

The Unified Distributed Database for the AI Era.

Follow Us
Products
OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
Resources
DocsBlogLive DemosTraining & Certification
Company
About OceanBaseTrust CenterLegalPartnerContact Us
Follow Us

© OceanBase 2026. All rights reserved

Cloud Service AgreementPrivacy PolicySecurity
Contact Us
Document Feedback
  1. Documentation Center
  2. OceanBase Connector/J
  3. V2.4.5
iconOceanBase Connector/J
V 2.4.5
  • V 2.4.17
  • V 2.4.16
  • V 2.4.15
  • V 2.4.14
  • V 2.4.5
  • V 2.4.4
  • V 2.4.3
  • V 2.4.2
  • V 2.4.1
  • V 2.4.0
  • V 2.2.11
  • V 2.2.10
  • V 2.2.7
  • V 2.2.6
  • V 2.2.3
  • V 2.2.0

java.sql.ResultSet

Last Updated:2026-04-09 07:21:37  Updated
share
What is on this page
Description
Methods

folded

share

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 Supported in Oracle mode? 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
What is on this page
Description
Methods