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.17
  • What is OceanBase Connector J?
    • Overview of OceanBase Connector/J
    • Compatibility requirements
  • Install Driver
    • Install and load OceanBase Connector/J
  • Instructions
    • Quick start
      • Import packages
      • Establish 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
      • clientInfoProvider
    • 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 remarks
      • 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.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.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.17

javax.sql.PooledConnection

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

Description
Methods

javax.sql.PooledConnection is a pooled connection interface.

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 in 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 getPoolConnection method of the ConnectionPoolDataSource interface 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 close() method of the Connection object. When connection pooling is completed, the connection pool manager is notified because it has registered itself as a ConnectionEventListener object by using the addConnectionEventListener() method of the PooledConnection interface. 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 object or returns a PooledConnection object 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 close() method of the PooledConnection interface. 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 PreparedStatement object, it calls the close() method of the PreparedStatement interface. When statement pooling is completed, the pool manager is notified because it has registered itself as a StatementEventListener object by using the addStatementEventListener() method of the PooledConnection interface. Therefore, when an application closes its PreparedStatement object, the underlying prepared statement is recycled rather than closed.

Methods

Method
Return type
Supported in Oracle mode
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

com.oceanbase.jdbc.ObPrepareStatement
Next
on this page
Description
Methods