Class OracleConnectionPoolDataSource

  • All Implemented Interfaces:
    java.beans.PropertyChangeListener, java.io.Serializable, java.sql.Wrapper, java.util.EventListener, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.ConnectionPoolDataSource, javax.sql.DataSource, OracleCommonDataSource, OracleConnectionPoolDataSource, OracleDataSource, oracle.jdbc.diagnostics.Diagnosable, oracle.jdbc.internal.Monitor, oracle.jdbc.replay.internal.OracleConnectionPoolDataSource, oracle.jdbc.replay.internal.OracleDataSource, OracleConnectionPoolDataSource, OracleDataSource
    Direct Known Subclasses:
    OracleConnectionPoolDataSource, OracleConnectionPoolDataSourceImpl

    public class OracleConnectionPoolDataSource
    extends OracleDataSource
    implements OracleConnectionPoolDataSource, oracle.jdbc.replay.internal.OracleConnectionPoolDataSource

    A DataSource object is a factory for Connection objects. An object that implements the DataSource interface will typically be registered with a JNDI service provider. A JDBC driver that is accessed via the DataSource API does not automatically register itself with the DriverManager.

    This data souce implements the standard JDBC javax.sql.OracleConnectionPoolDataSource and the Oracle JDBC extension oracle.jdbc.datasource.OracleConnectionPoolDataSource interfaces.

    This data Source also supports Application Continuity (AC) and transparent JDBC operation replay upon a failover. To disable such feature, set "oracle.jdbc.enableACSupport" to false either as a Java system property, or as a connection property on this data source.

    The following example illustrates the use of this data source to create a JDBC PooledConnection:

      
        oracle.jdbc.datasource.OracleConnectionPoolDataSource ocpds =
          new oracle.jdbc.datasource.impl.OracleConnectionPoolDataSource();
        ocpds.setURL("jdbc:oracle:thin:@//dbhost:dbport/dbservice");
        ocpds.setUser("User");
        ocpds.setPassword("Passwd");
        ocpds.setConnectionProperty("connProp1", "value1");
        ocpds.setConnectionProperty("connProp2", "value2");
     
        javax.sql.PooledConnection pc = ocpds.getPooledConnection();
      
      

    The following example illustrates the use of a connection obtained from this data source for Application Continuity protection:

      
        PooledConnection pc = rcpds.getPooledConnection();
        Connection conn = pc.getConnection();  // Implicit request begin
        ......  // JDBC calls protected by Application Continuity
        conn.close();  // Implicit request end
      
      

    Since:
    20c
    See Also:
    Serialized Form
    • Constructor Detail

      • OracleConnectionPoolDataSource

        public OracleConnectionPoolDataSource()
                                       throws java.sql.SQLException
        Throws:
        java.sql.SQLException
    • Method Detail

      • getPooledConnection

        public javax.sql.PooledConnection getPooledConnection()
                                                       throws java.sql.SQLException

        Attempt to establish a database connection.

        Specified by:
        getPooledConnection in interface javax.sql.ConnectionPoolDataSource
        Specified by:
        getPooledConnection in interface OracleConnectionPoolDataSource
        Returns:
        a PooledConnection to the database
        Throws:
        java.sql.SQLException - if a database-access error occurs.
      • getPooledConnection

        public javax.sql.PooledConnection getPooledConnection​(java.lang.String _user,
                                                              java.lang.String _password)
                                                       throws java.sql.SQLException

        Attempt to establish a database connection.

        Specified by:
        getPooledConnection in interface javax.sql.ConnectionPoolDataSource
        Specified by:
        getPooledConnection in interface OracleConnectionPoolDataSource
        Parameters:
        user - the database user on whose behalf the Connection is being made
        password - the user's password
        Returns:
        a PooledConnection to the database
        Throws:
        java.sql.SQLException - if a database-access error occurs.
      • getPhysicalConnection

        protected java.sql.Connection getPhysicalConnection()
                                                     throws java.sql.SQLException
        Get a Physical Connection with default url, user name, and password
        Throws:
        java.sql.SQLException
      • getPhysicalConnection

        protected java.sql.Connection getPhysicalConnection​(java.lang.String _url,
                                                            java.lang.String _user,
                                                            java.lang.String _passwd)
                                                     throws java.sql.SQLException
        Get a Physical Connection with the given url, user name, and password
        Throws:
        java.sql.SQLException
      • getPhysicalConnection

        protected java.sql.Connection getPhysicalConnection​(java.lang.String _user,
                                                            java.lang.String _passwd)
                                                     throws java.sql.SQLException
        Get a Physical Connection with the user name and password & default URL
        Throws:
        java.sql.SQLException
      • getPhysicalConnection

        protected java.sql.Connection getPhysicalConnection​(java.lang.String _url,
                                                            java.lang.String _user,
                                                            oracle.jdbc.internal.OpaqueString _passwd)
                                                     throws java.sql.SQLException
        Get a Physical Connection with the given url, user name, and password
        Throws:
        java.sql.SQLException
      • getPhysicalConnection

        protected java.sql.Connection getPhysicalConnection​(java.lang.String _user,
                                                            oracle.jdbc.internal.OpaqueString _passwd)
                                                     throws java.sql.SQLException
        Get a Physical Connection with the user name and password & default URL
        Throws:
        java.sql.SQLException
      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.sql.SQLException
        Description copied from class: OracleDataSource

        Attempt to establish a database connection.

        Specified by:
        getConnection in interface javax.sql.DataSource
        Overrides:
        getConnection in class OracleDataSource
        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 usr,
                                                 java.lang.String pwd)
                                          throws java.sql.SQLException
        Description copied from class: OracleDataSource

        Attempt to establish a database connection.

        Specified by:
        getConnection in interface javax.sql.DataSource
        Overrides:
        getConnection in class OracleDataSource
        Parameters:
        usr - the database user on whose behalf the Connection is being made
        pwd - 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 props)
                                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException