Class PoolXADataSourceImpl

  • All Implemented Interfaces:
    java.io.Serializable, java.sql.Wrapper, javax.naming.Referenceable, javax.naming.spi.ObjectFactory, javax.sql.CommonDataSource, javax.sql.DataSource, javax.sql.XADataSource, Diagnosable, PoolDataSource, PoolXADataSource, UniversalConnectionPoolAdapter

    public class PoolXADataSourceImpl
    extends PoolDataSourceImpl
    implements PoolXADataSource, java.io.Serializable, javax.naming.Referenceable, javax.naming.spi.ObjectFactory, 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:
    Serialized Form
    • Constructor Detail

      • PoolXADataSourceImpl

        public PoolXADataSourceImpl()
    • Method Detail

      • getConnection

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

        public java.sql.Connection getConnection​(java.lang.String username,
                                                 java.lang.String password)
                                          throws java.sql.SQLException
        Description copied from class: PoolDataSourceImpl
        Attempts to obtain a database connection.
        Specified by:
        getConnection in interface javax.sql.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:
        java.sql.SQLException - if a database-access error occurs.
      • getConnection

        public java.sql.Connection getConnection​(java.util.Properties labels)
                                          throws java.sql.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:
        java.sql.SQLException - if a database-access error occurs.
      • getConnection

        public java.sql.Connection getConnection​(java.lang.String username,
                                                 java.lang.String password,
                                                 java.util.Properties labels)
                                          throws java.sql.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:
        java.sql.SQLException - if a database-access error occurs.
      • getXAConnection

        public javax.sql.XAConnection getXAConnection()
                                               throws java.sql.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 javax.sql.XADataSource
        Returns:
        an XAConnection object, which represents a physical connection to a data source, that can be used in a distributed transaction
        Throws:
        java.sql.SQLException - if a database access error occurs
      • getXAConnection

        public javax.sql.XAConnection getXAConnection​(java.lang.String user,
                                                      java.lang.String password)
                                               throws java.sql.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 javax.sql.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:
        java.sql.SQLException - if a database access error occurs.
      • getXAConnection

        public javax.sql.XAConnection getXAConnection​(java.util.Properties labels)
                                               throws java.sql.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:
        java.sql.SQLException - if a database access error occurs.
      • getXAConnection

        public javax.sql.XAConnection getXAConnection​(java.lang.String username,
                                                      java.lang.String password,
                                                      java.util.Properties labels)
                                               throws java.sql.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:
        java.sql.SQLException - if a database access error occurs.
      • getConnection

        protected java.sql.Connection getConnection​(oracle.ucp.jdbc.UCPConnectionBuilderImpl builder)
                                             throws java.sql.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:
        java.sql.SQLException - if a database-access error occurs.