org.apache.commons.dbcp2.managed

Class BasicManagedDataSource

  • All Implemented Interfaces:
    AutoCloseable, Wrapper, MBeanRegistration, CommonDataSource, DataSource, BasicDataSourceMXBean


    public class BasicManagedDataSource
    extends BasicDataSource

    BasicManagedDataSource is an extension of BasicDataSource which creates ManagedConnections. This data source can create either full two-phase-commit XA connections or one-phase-commit local connections. Both types of connections are committed or rolled back as part of the global transaction (a.k.a. XA transaction or JTA Transaction), but only XA connections can be recovered in the case of a system crash.

    BasicManagedDataSource adds the TransactionManager and XADataSource properties. The TransactionManager property is required and is used to enlist connections in global transactions. The XADataSource is optional and if set is the class name of the XADataSource class for a two-phase-commit JDBC driver. If the XADataSource property is set, the driverClassName is ignored and a DataSourceXAConnectionFactory is created. Otherwise, a standard DriverConnectionFactory is created and wrapped with a LocalXAConnectionFactory.

    Since:
    2.0
    See Also:
    BasicDataSource, ManagedConnection

Copyright © 2001–2018 The Apache Software Foundation. All rights reserved.