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.4
  • 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
      • Example
    • 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
        • LOB data interface
        • LOB locator API
      • 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
      • 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 feature
    • 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.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.4

Overview of OceanBase Connector/J

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

OceanBase Connector/J as a driver
Features

Java Database Connectivity (JDBC) is a Java standard that provides an API for connecting Java programs to a relational database. OceanBase Connector/J is a driver that implements the JDBC API to provide connections to OceanBase Database for Java-based applications.

The JDBC standard was defined by Sun Microsystems and is implemented by the standard java.sql API. Vendors can implement and extend it by using their own JDBC drivers. JDBC is a Call Level Interface (CLI) based on X/Open SQL.

OceanBase Connector/J as a driver

OceanBase Connector/J is a JDBC Type 4 driver that can be connected to a database engine by using local protocols. OceanBase Database supports OceanBase Connector/J and is fully compatible with MySQL Connector Java, the native JDBC driver for MySQL. OceanBase Connector/J automatically determines whether OceanBase Database runs in MySQL or Oracle mode and supports both modes at the protocol layer.

OceanBase Connection/J is compatible with the OB2.0 protocol.

Notice

OceanBase Database determines to run in MySQL or Oracle mode based on the tenant name that is used when the JDBC driver is connected to the database service. Tenants in Oracle mode can use only Oracle-compatible SQL syntax.

OceanBase Connector/J is compatible with standard JDBC APIs and Oracle JDBC. OceanBase Database in Oracle mode supports most Oracle syntax.

Features

OceanBase Connector/J mainly provides the following features:

  • DriverManager: Loads the driver and returns the corresponding database connections based on the call requests.

  • Driver: Handles requests and returns the corresponding database connections. It is loaded into DriverManager.

  • Connection: Communicates with the database, provides a connection environment for SQL execution and transaction handling, and creates and executes statements.

  • Statement:

    • Statements: Performs a single SQL query or update operation.

    • PreparedStatement: Executes cached statements with a pre-determined execution path. Cached statements can be repeatedly executed to improve execution efficiency.

    • CallableStatement: Executes stored procedures in the database.

  • SQLException: Displays errors that occur when creating or closing connections with the database or when executing SQL statements.

Next topic

Compatibility requirements
Next
on this page
OceanBase Connector/J as a driver
Features