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

  • What's New
  • What is OceanBase Connector J?
    • Overview of OceanBase Connector/J
    • Compatibility requirements
  • Instructions
    • Install and load the OceanBase Connector/J driver
    • Connect Python applications to OceanBase Database
    • Basic operations
      • 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
    • Handle SQL exceptions
    • Use CallableStatements to call stored procedures
    • Java data streams
      • Overview of Java data streams
      • LONG and LONG RAW data types
      • LOB data types
    • Use LOBs
      • Overview of LOB data types
      • LOB data interface
      • LOB locator API
      • CHAR, VARCHAR, and RAW data types
    • Data sources and URL
      • Data source overview
      • Data source characteristics and properties
      • Create and connect to a data source instance
      • Database URL
    • Result set
      • Overview of result sets
      • Limits
      • FetchSize
      • refreshRow
      • useCursorFetch
    • Statement caching
      • Overview of statement caching
      • Use statement caching
      • Reuse statement objects
    • Failover and load balancing modes
    • Batch processing
    • Security features
    • SQL NetworkCostInfo
    • Troubleshooting
    • Common APIs
      • Overview of common APIs
      • 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
    • Reference
      • Supported SQL and PL data types
  • Features specific to the Oracle mode
    • Binary Protocol (Prepared Statements)
      • COM_STMT_PREPARE_EXECUTE
      • COM_STMT_SEND_PIECE_DATA
    • Call PL stored procedures
    • Result set performance
    • Use ARRAY and STRUCT classes
    • Distributed transactions
      • Overview of distributed transactions
      • XA components
      • Distributed transaction examples
    • Error messages in Oracle mode
    • Data types supported in Oracle mode

Download PDF

What's New Overview of OceanBase Connector/J Compatibility requirements Install and load the OceanBase Connector/J driver Connect Python applications to OceanBase Database 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 Handle SQL exceptions Use CallableStatements to call stored procedures Overview of Java data streams LONG and LONG RAW data types LOB data types Overview of LOB data types LOB data interface LOB locator API CHAR, VARCHAR, and RAW data types Data source overview Data source characteristics and properties Create and connect to a data source instance Database URL Overview of result sets Limits FetchSize refreshRow useCursorFetch Overview of statement caching Use statement caching Reuse statement objects Failover and load balancing modesBatch processing Security features SQL NetworkCostInfo Troubleshooting Overview of common APIs 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 Supported SQL and PL data types COM_STMT_PREPARE_EXECUTE COM_STMT_SEND_PIECE_DATA Call PL stored procedures Result set performance Use ARRAY and STRUCT classes Overview of distributed transactions XA components Distributed transaction examples Error messages in Oracle mode Data types supported in Oracle mode
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.2.7
iconOceanBase Connector/J
V 2.2.7
  • 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

javax.sql.PooledConnection

Last Updated:2023-07-27 06:37:15  Updated
share
What is on this page
Description
Methods

folded

share

javax.sql.PooledConnection is a connection interface created by a connection pool.

Description

javax.sql.PooledConnection provides hooks for connection pool management. A PooledConnection object represents a physical connection to a data source. When an application finishes using a connection, the connection can be recycled rather than closed, thus reducing the number of connections that need to be established.

An application programmer does not directly use the PooledConnection interface. The interface is instead used by a middle-tier infrastructure that manages connection pools.

When an application calls the DataSource.getConnection method, a Connection object is returned. If connection pooling is under progress, the Connection object is actually a handle to a PooledConnection object, which is a physical connection.

The connection pool manager, typically the application server, maintains a pool of PooledConnection objects. If a PooledConnection object is available in the pool, the connection pool manager returns a Connection object that is a handle to the physical connection. If no PooledConnection object is available, the connection pool manager calls the ConnectionPoolDataSource method getPoolConnection to create a new physical connection. The JDBC driver that implements ConnectionPoolDataSource creates a new PooledConnection object and returns a handle to it.

When an application closes a connection, it calls the Connection method close(). When connection pooling is completed, the connection pool manager is notified because it has registered itself as a ConnectionEventListener object by using the ConnectionPool method addConnectionEventListener(). The connection pool manager deactivates the handle to the PooledConnection object and returns the PooledConnection object to the pool of connections so that it can be used again. Thus, when an application closes its connection, the underlying physical connection is recycled rather than closed.

For a logical handle returned by the call of PoolConnection.getConnection, if the connection pool manager packages or provides a corresponding proxy, the pool manager must execute one of the following operations to call Connection.close() when the connection pool manager closes a PooledConnection or returns a PooledConnection to the pool in response to the application:

  • Call endRequest() on the logical connection handle;

  • Call close() on the logical connection handle.

The physical connection is not closed until the connection pool manager calls the PooledConnection method close(). This method is generally called to orderly shut down the server or called when a fatal error has rendered the connection unusable.

A connection pool manager is often also a statement pool manager that maintains a pool of PreparedStatement objects. When an application closes a prepared statement, it calls the PreparedStatement method close(). When Statement pooling is completed, the pool manager is notified because it has registered itself as a StatementEventListener object by using the ConnectionPool method addStatementEventListener(). Therefore, when an application closes its PreparedStatement, the underlying prepared statement is recycled rather than closed.

Methods

Method Return type JDBC 4 supported in Oracle mode JDBC 4 supported in MySQL mode
getConnection() Connection Yes Yes
close() void Yes Yes
addConnectionEventListener(ConnectionEventListener listener) void Yes Yes
removeConnectionEventListener(ConnectionEventListener listener) void Yes Yes
addStatementEventListener(StatementEventListener listener) void Yes Yes
removeStatementEventListener(StatementEventListener listener) void Yes Yes

Previous topic

javax.naming.Context
Last

Next topic

Supported SQL and PL data types
Next
What is on this page
Description
Methods