Meet OceanBase AI Database, the unified database for operational data, real-time analytics, and AI. Explore ->

Meet OceanBase AI Database, the unified database for operational data, real-time analytics, and AI. Explore ->

OceanBase logo

OceanBase

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

Product Overview
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

OceanBase

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

Product Overview
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.18

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

Download PDF

Compatibility requirements Overview of OceanBase Connector/J Install and load OceanBase Connector/J Manage tables and data Close a database connection Process ResultSet objects Close ResultSet and Statement objects Commit changes Create a Statement object Run queries and retrieve ResultSet objects Examples Import packages Establish a database connection clientInfoProvider Database URL Data source overview Overview of Java data streams LONG and LONG RAW data types CHAR, VARCHAR, and RAW data types Call a stored procedure Handle SQL exceptions Overview of result sets useCursorFetch FetchSize Limitations refreshRow Batch processing LoadBalance strategies Failover and load balancing modes Load balancing strategy configuration methods Replication mode Rich client Logging Network overheads Show Trace Security features Troubleshooting Overview of statement caching Reuse statement objects Use statement caching Supported SQL and PL data types Behavior differences between JDBC strict compatibility mode and non-strict compatibility mode Call PL stored procedures Scrollability of a result set Use ARRAY and STRUCT classes Obtain remarks Data types supported in Oracle mode Error messages in Oracle mode Overview java.sql.ResultSet javax.naming.Context javax.sql.ConnectionPoolDataSource java.sql.DatabaseMetaData java.sql.ParameterMetaData java.sql.Statement javax.sql.PooledConnection java.sql.ResultSetMetaData java.sql.Driver java.sql.CallableStatement com.oceanbase.jdbc.ObPrepareStatement java.sql.Connection java.sql.PreparedStatement OceanBase Connector/J V2.4.18 OceanBase Connector/J V2.4.17 OceanBase Connector/J V2.4.16 OceanBase Connector/J V2.4.15 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 OceanBase Connector/J V2.2.11 OceanBase Connector/J V2.2.7 OceanBase Connector/J V2.2.0 OceanBase Connector/J V2.2.6 OceanBase Connector/J V2.2.3 OceanBase Connector/J V2.2.10
OceanBase logo

The Unified Distributed Database for the AI Era.

Follow Us
Products
OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
Resources
DocsBlogWhite PaperLive DemosTraining & CertificationTicket
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.18
iconOceanBase Connector/J
V 2.4.18
Databases
  • OceanBase Database
  • OceanBase Cloud
  • OceanBase Tugraph
  • Interactive Tutorials
  • OceanBase Best Practices
Tools
  • OceanBase Cloud Platform
  • OceanBase Migration Service
  • OceanBase Developer Center
  • OceanBase Migration Assessment
  • OceanBase Admin Tool
  • OceanBase Loader and Dumper
  • OceanBase Deployer
  • Kubernetes operator for OceanBase
  • OceanBase Diagnostic Tool
  • OceanBase Binlog Service
Connectors and Middleware
  • OceanBase Database Proxy
  • Embedded SQL in C for OceanBase
  • OceanBase Call Interface
  • OceanBase Connector/C
  • OceanBase Connector/J
  • OceanBase Connector/ODBC
  • OceanBase Connector/NET
  • V 2.4.18
  • 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

Run queries and retrieve ResultSet objects

Last Updated:2026-05-11 09:50:06  Updated
Share
What is on this page
Share

Statement objects use the executeQuery method to query the database. The method takes an SQL statement as input and returns a ResultSet object.

Note

  • The method for executing a Statement object depends on the type of the SQL statement to be executed. If the Statement object indicates an SQL query that requires a ResultSet object be returned, the executeQuery method is applicable. If the SQL statement is a DDL or DML statement for updating the count, the executeUpdate method is applicable. If the type of the SQL statement is unknown, the execute method is applicable.
  • For OceanBase Connector/J, even if no ResultSet object is returned for the SQL string being executed, the executeQuery method does not throw an SQL exception.

Example: Use the Statement object st to run a query and return a ResultSet object that contains data of the name column in the customers table.

ResultSet rs = st.executeQuery ("SELECT name FROM customers");

Previous topic

Create a Statement object
Last

Next topic

Process ResultSet objects
Next