Class PoolXADataSourceImpl

java.lang.Object
oracle.ucp.jdbc.PoolDataSourceImpl
oracle.ucp.jdbc.PoolXADataSourceImpl
All Implemented Interfaces:
Serializable, Wrapper, Referenceable, ObjectFactory, CommonDataSource, DataSource, XADataSource, Diagnosable, PoolDataSource, PoolXADataSource, UniversalConnectionPoolAdapter

A connection pool-aware data source. This DataSource uses the Universal Connection Pool to get an XAconneciton, creating a proxy to that connection, and returning the proxy to the client. When the client calls close on the XAConnection proxy, the underlying physical connection is usually returned to the pool. Also see the proxy factory.

Besides other data source properties, applications must set the connection factory class name. The connection factory class is a class that implements javax.sql.XADataSource and does not implement its own connection pooling. The connection factory's getXAConnection(...) methods should return a physical XAConnection to the database. For example, "oracle.jdbc.xa.client.OracleXADataSource" is a valid connection factory class name.

See Also:
  • Constructor Details

    • PoolXADataSourceImpl

      public PoolXADataSourceImpl()
  • Method Details

    • createPoolWithDefaultProperties

      protected void createPoolWithDefaultProperties() throws SQLException
      Overrides:
      createPoolWithDefaultProperties in class PoolDataSourceImpl
      Throws:
      SQLException
    • getConnection

      public Connection getConnection() throws SQLException
      Description copied from class: PoolDataSourceImpl
      Attempts to obtain a database connection.
      Specified by:
      getConnection in interface DataSource
      Overrides:
      getConnection in class PoolDataSourceImpl
      Returns:
      A Connection to the database.
      Throws:
      SQLException - if a database-access error occurs.
    • getConnection

      public Connection getConnection(String username, String password) throws SQLException
      Description copied from class: PoolDataSourceImpl
      Attempts to obtain a database connection.
      Specified by:
      getConnection in interface DataSource
      Overrides:
      getConnection in class PoolDataSourceImpl
      Parameters:
      username - The database user on whose behalf the connection is being made.
      password - The user's password.
      Returns:
      A Connection to the database.
      Throws:
      SQLException - if a database-access error occurs.
    • getConnection

      public Connection getConnection(Properties labels) throws SQLException
      Description copied from class: PoolDataSourceImpl
      Attempts to obtain a database connection with the requested connection labels.
      Specified by:
      getConnection in interface PoolDataSource
      Overrides:
      getConnection in class PoolDataSourceImpl
      Parameters:
      labels - The requested connection labels.
      Returns:
      A Connection to the database.
      Throws:
      SQLException - if a database-access error occurs.
    • getConnection

      public Connection getConnection(String username, String password, Properties labels) throws SQLException
      Description copied from class: PoolDataSourceImpl
      Attempts to obtain a database connection with the requested connection labels.
      Specified by:
      getConnection in interface PoolDataSource
      Overrides:
      getConnection in class PoolDataSourceImpl
      Parameters:
      username - The database user on whose behalf the connection is being made.
      password - The user's password.
      labels - The requested connection labels.
      Returns:
      A Connection to the database.
      Throws:
      SQLException - if a database-access error occurs.
    • getXAConnection

      public XAConnection getXAConnection() throws SQLException
      Obtains an XAConnection from the embedded Universal Connection Pool instance. Each XAConnection represents a physical database connection can be used in a distributed transaction.
      Specified by:
      getXAConnection in interface PoolXADataSource
      Specified by:
      getXAConnection in interface XADataSource
      Returns:
      an XAConnection object, which represents a physical connection to a data source, that can be used in a distributed transaction
      Throws:
      SQLException - if a database access error occurs
    • getXAConnection

      public XAConnection getXAConnection(String user, String password) throws SQLException
      Obtains an XAConnection from the embedded Universal Connection Pool instance, using the given user name and password. Each XAConnection represents a physical database connection can be used in a distributed transaction.
      Specified by:
      getXAConnection in interface PoolXADataSource
      Specified by:
      getXAConnection in interface XADataSource
      Parameters:
      user - The database user on whose behalf the connection is being made.
      password - The user's password.
      Returns:
      an XAConnection object, which represents a physical connection to a data source, that can be used in a distributed transaction.
      Throws:
      SQLException - if a database access error occurs.
    • getXAConnection

      public XAConnection getXAConnection(Properties labels) throws SQLException
      Obtains an XAConnection from the embedded Universal Connection Pool instance, using the given connection labels. Each XAConnection represents a physical database connection can be used in a distributed transaction.
      Specified by:
      getXAConnection in interface PoolXADataSource
      Parameters:
      labels - The requested connection labels.
      Returns:
      an XAConnection object, which represents a physical connection to a data source, that can be used in a distributed transaction.
      Throws:
      SQLException - if a database access error occurs.
    • getXAConnection

      public XAConnection getXAConnection(String username, String password, Properties labels) throws SQLException
      Obtains an XAConnection from the embedded Universal Connection Pool instance, using the given user name, password, and connection labels. Each XAConnection represents a physical database connection can be used in a distributed transaction.
      Specified by:
      getXAConnection in interface PoolXADataSource
      Parameters:
      username - The database user on whose behalf the connection is being made.
      password - The user's password.
      labels - The requested connection labels.
      Returns:
      an XAConnection object, which represents a physical connection to a data source, that can be used in a distributed transaction.
      Throws:
      SQLException - if a database access error occurs.
    • getConnection

      protected Connection getConnection(oracle.ucp.jdbc.UCPConnectionBuilderImpl builder) throws SQLException
      Description copied from class: PoolDataSourceImpl
      Internal method that attempts to obtain a database connection with the parameters set on the builder.
      Overrides:
      getConnection in class PoolDataSourceImpl
      Parameters:
      builder - the builder object containing the connection properties
      Returns:
      A Connection to the database.
      Throws:
      SQLException - if a database-access error occurs.
    • createXAConnectionBuilder

      public UCPXAConnectionBuilder createXAConnectionBuilder()
      Description copied from interface: PoolXADataSource
      Creates a new XAConnectionBuilder instance.
      Specified by:
      createXAConnectionBuilder in interface PoolXADataSource
      Specified by:
      createXAConnectionBuilder in interface XADataSource
      Returns:
      Connection builder that builds OracleXAConnection