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

Show Trace

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

The end-to-end diagnostics feature of OceanBase Database records the time consumed in each stage of the trace from a client to an OceanBase Database Proxy (ODP) and then to an OBServer node, and records the trace information related to component diagnostics.

OceanBase Connector/J supports the Show Trace feature based on the end-to-end tracing feature. You can run the Show Trace command to obtain the end-to-end trace of the last task in the session.

When you use OceanBase Connector/J to connect to a database, you can specify enableFullLinkTrace=true in the URL to enable the end-to-end tracing feature, and specify SET ob_enable_show_trace = TRUE; in the SQL statement to enable the Show Trace feature.

Here is an example:

Connection conn = setConnection("&enableFullLinkTrace=true");
Statement stmt = conn.createStatement();

stmt.execute("set ob_enable_show_trace = true");
createTable("test_trace", "c1 int");
stmt.execute("insert into test_trace values (111)");
ResultSet rs = stmt.executeQuery("select * from test_trace");
Assert.assertTrue(rs.next());
Assert.assertEquals(111, rs.getInt(1));
Assert.assertFalse(rs.next());

rs = stmt.executeQuery("show trace");
while (rs.next()) {
    System.out.println(rs.getString(1) + "    " + rs.getString(2) + "    " + rs.getString(3));
}

Note

OceanBase Database V4.1.0 provides the ob_enable_show_trace variable. This system variable allows you to enable or disable the Show Trace feature during end-to-end diagnostics. If you connect to OceanBase Database V4.0.0 or earlier, you still need to use the ob_enable_trace_log variable to enable or disable the Show Trace feature.

The following example shows the result set of the Show Trace command:

oceanbase_jdbc    2023-02-10 10:32:20.167    60000 µs
└── com_query_process    2023-02-10 10:32:20.32195    51117 µs
└── mpquery_single_stmt    2023-02-10 10:32:20.321953    51103 µs
├── sql_compile    2023-02-10 10:32:20.321961    50749 µs
│   ├── pc_get_plan    2023-02-10 10:32:20.321962    4 µs
│   └── hard_parse    2023-02-10 10:32:20.321991    50711 µs
│       ├── parse    2023-02-10 10:32:20.321992    19 µs
│       ├── resolve    2023-02-10 10:32:20.322028    93 µs
│       ├── rewrite    2023-02-10 10:32:20.322158    183 µs
│       ├── optimize    2023-02-10 10:32:20.322356    2048 µs
│       │   ├── inner_execute_read    2023-02-10 10:32:20.322902    1296 µs
│       │   │   ├── sql_compile    2023-02-10 10:32:20.322914    1176 µs
│       │   │   │   ├── pc_get_plan    2023-02-10 10:32:20.322916    7 µs
│       │   │   │   └── hard_parse    2023-02-10 10:32:20.322948    1134 µs
│       │   │   │       ├── parse    2023-02-10 10:32:20.322949    56 µs
│       │   │   │       ├── resolve    2023-02-10 10:32:20.323024    184 µs
│       │   │   │       ├── rewrite    2023-02-10 10:32:20.323246    287 µs
│       │   │   │       ├── optimize    2023-02-10 10:32:20.323549    356 µs
│       │   │   │       ├── code_generate    2023-02-10 10:32:20.323922    76 µs
│       │   │   │       └── pc_add_plan    2023-02-10 10:32:20.324033    37 µs
│       │   │   ├── open    2023-02-10 10:32:20.3241    26 µs
│       │   │   ├── get_das_id    2023-02-10 10:32:20.324141    1 µs
│       │   │   └── do_local_das_task    2023-02-10 10:32:20.324152    24 µs
│       │   └── close    2023-02-10 10:32:20.32421    38 µs
│       │       ├── close_das_task    2023-02-10 10:32:20.324213    4 µs
│       │       └── end_transaction    2023-02-10 10:32:20.324229    2 µs
│       ├── code_generate    2023-02-10 10:32:20.324419    59 µs
│       └── pc_add_plan    2023-02-10 10:32:20.372656    28 µs
└── sql_execute    2023-02-10 10:32:20.372722    302 µs
├── open    2023-02-10 10:32:20.372722    15 µs
├── response_result    2023-02-10 10:32:20.372747    125 µs
│   ├── get_das_id    2023-02-10 10:32:20.372749    1 µs
│   └── do_local_das_task    2023-02-10 10:32:20.37276    27 µs
└── close    2023-02-10 10:32:20.372882    116 µs
├── close_das_task    2023-02-10 10:32:20.372883    7 µs
└── end_transaction    2023-02-10 10:32:20.372974    3 µs

Previous topic

Network overheads
Last

Next topic

Security features
Next