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.5

  • What is OceanBase Connector J?
    • Compatibility requirements
    • Overview of OceanBase Connector/J
  • Install Driver
    • Install and load the OceanBase Connector/J driver
  • Instructions
    • Quick start
      • Process ResultSet objects
      • Close ResultSet and Statement objects
      • Manage tables and data
      • Commit changes
      • Close a database connection
      • Create a Statement object
      • Run queries and retrieve ResultSet objects
      • Examples
      • Import packages
      • Create a database connection
    • Data sources and URL
      • 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
    • Statement caching
      • Overview of statement caching
      • Reuse statement objects
      • Use statement caching
    • Call a stored procedure
    • Handle SQL exceptions
    • Result set
      • Overview of result sets
      • Limitations
      • FetchSize
      • refreshRow
      • useCursorFetch
    • Batch processing
    • Failover and Load-Balancing
      • LoadBalance strategies
      • Failover and load balancing modes
      • Load balancing strategy configuration methods
    • Rich client
    • Logging
    • Network overheads
    • Show Trace
    • Security features
    • Troubleshooting
  • Reference
    • Supported SQL and PL data types
    • 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 comments
      • 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.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 the OceanBase Connector/J driver Process ResultSet objects Close ResultSet and Statement objects Manage tables and data Commit changes Close a database connection Create a Statement object Run queries and retrieve ResultSet objects Examples Import packages Create a database connectionDatabase URL Data source overview Overview of Java data streams LONG and LONG RAW data types CHAR, VARCHAR, and RAW data types Overview of statement caching Reuse statement objects Use statement caching Call a stored procedure Handle SQL exceptions Overview of result sets Limitations FetchSize refreshRow useCursorFetch Batch processing LoadBalance strategies Failover and load balancing modes Load balancing strategy configuration methods Rich client Logging Network overheads Show Trace Security features Troubleshooting Supported SQL and PL data types 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 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.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.5
iconOceanBase Connector/J
V 2.4.5
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

Troubleshooting

Last Updated:2026-04-09 07:21:37  Updated
Share
What is on this page
Troubleshoot an error with the error message "Could not read resultset: unexpected end of stream, read 0 bytes from 4"
Perform lightweight ping/ operations to avoid excessive use of "SELECT 1"

folded

Share

This topic lists the general problems and the corresponding troubleshooting methods.

Troubleshoot an error with the error message "Could not read resultset: unexpected end of stream, read 0 bytes from 4"

The error occurs during communication with the server.

In most cases, this is caused by queries with a large number of result sets. A server usually expects the client to rapidly read the result set. net_write_timeout specifies the read timeout period. The default value is 60s. If the client fails to read the entire result set during this period, the server discards the connection. If you do not want to process the results in the specified period, you can run SET STATEMENT net_write_timeout = 10000 FOR XXX, where XXX indicates a "general" query. In this case, set net_write_timeout to a larger value for the query, which is 10000 in this example.

If the application uses many long queries configured with FetchSize, you can use the sessionVariables = net_write_timeout = xxx option to set the connection.

Perform lightweight ping/ operations to avoid excessive use of "SELECT 1"

You can use Connection.isValid() to perform lightweight ping/ operations to avoid excessive use of SELECT 1. Connection.isValid() implements ping operations in MySQL protocols, rather than on the network.

Previous topic

Security features
Last

Next topic

COM_STMT_PREPARE_EXECUTE
Next
What is on this page
Troubleshoot an error with the error message "Could not read resultset: unexpected end of stream, read 0 bytes from 4"
Perform lightweight ping/ operations to avoid excessive use of "SELECT 1"