# Package org.apache.tomcat.dbcp.dbcp2.managed

package org.apache.tomcat.dbcp.dbcp2.managed

This package provides support for pooling of ManagedConnections. A managed connection is responsible for managing a database connection in a transactional environment (typically called Container Managed). A managed connection operates like any other connection when no global transaction (a.k.a. XA transaction or JTA Transaction) is in progress. When a global transaction is active a single physical connection to the database is used by all ManagedConnections accessed in the scope of the transaction. Connection sharing means that all data access during a transaction has a consistent view of the database. When the global transaction is committed or rolled back the enlisted connections are committed or rolled back.

This package supports full XADataSources and non-XA data sources using local transaction semantics. non-XA data sources commit and rollback as part of the transaction but are not recoverable in the case of an error because they do not implement the two-phase commit protocol.

Related Packages
Package
Description
org.apache.tomcat.dbcp.dbcp2
Database Connection Pool API.
org.apache.tomcat.dbcp.dbcp2.cpdsadapter
This package contains one public class which is a `ConnectionPoolDataSource` (CPDS) implementation that can be used to adapt older `Driver` based JDBC implementations.
org.apache.tomcat.dbcp.dbcp2.datasources
This package contains two DataSources: `PerUserPoolDataSource` and `SharedPoolDataSource` which provide a database connection pool.
Class
Description
BasicManagedDataSource
BasicManagedDataSource is an extension of BasicDataSource which creates ManagedConnections.
DataSourceXAConnectionFactory
An implementation of XAConnectionFactory which uses a real XADataSource to obtain connections and XAResources.
LocalXAConnectionFactory
An implementation of XAConnectionFactory which manages non-XA connections in XA transactions.
LocalXAConnectionFactory.LocalXAResource
LocalXAResource is a fake XAResource for non-XA connections.
ManagedConnection<C extends Connection>
ManagedConnection is responsible for managing a database connection in a transactional environment (typically called "Container Managed").
ManagedDataSource<C extends Connection>
The ManagedDataSource is a PoolingDataSource that creates ManagedConnections.
PoolableManagedConnection
PoolableConnection that unregisters from TransactionRegistry on Connection real destroy.
PoolableManagedConnectionFactory
A `PoolableConnectionFactory` that creates `PoolableManagedConnection`s.
TransactionContext
TransactionContext represents the association between a single XAConnectionFactory and a Transaction.
TransactionContextListener
A listener for transaction completion events.
TransactionRegistry
TransactionRegistry tracks Connections and XAResources in a transacted environment for a single XAConnectionFactory.
XAConnectionFactory
XAConnectionFactory is an extension of ConnectionFactory used to create connections in a transaction managed environment.