Class OraclePooledConnection

  • <section role="region"> </section> <section role="region">
    • Constructor Detail

      • OraclePooledConnection

        public OraclePooledConnection()
      • OraclePooledConnection

        public OraclePooledConnection​(String url)
                               throws SQLException

        Creates a PooledConnection.

        Parameters:
        url - URL of the physical connection.
        Throws:
        SQLException
      • OraclePooledConnection

        public OraclePooledConnection​(String url,
                                      String user,
                                      String passwd)
                               throws SQLException

        Creates a PooledConnection.

        Parameters:
        url - URL of the physical connection.
        user - User Name
        passwd - Password
        Throws:
        SQLException
      • OraclePooledConnection

        public OraclePooledConnection​(Connection pc)

        Create a Pooled Connection.

        Parameters:
        pc - The corresponding physical connection.
      • OraclePooledConnection

        public OraclePooledConnection​(Connection pc,
                                      boolean ac)

        Create a Pooled Connection.

        Parameters:
        pc - The corresponding physical connection
        ac - autoCommit value
    </section> <section role="region">
    • Method Detail

      • getConnection

        public Connection getConnection()
                                 throws SQLException

        Create an object handle for this physical connection. The object returned is a temporary handle used by application code to refer to a physical connection that is being pooled.

        Specified by:
        getConnection in interface PooledConnection
        Returns:
        a Connection object
        Throws:
        SQLException - if a database-access error occurs.
      • setStmtCacheSize

        public void setStmtCacheSize​(int size)
                              throws SQLException
        Deprecated.
        Set the statement cache size. Default is 0. You cannot call this for logicalhandles obtained from PooledConnections.

        If more than <it> size </it> cursors are already cached than they will be closed. By default the meta data of the cursor will be saved. Only data and the state will be cleared. You need to call this first to enable either type of Statement caching. When both types of Statement caching are enabled, the <it> size </size> is the total number of cursors cached for both the schemes together.

        Parameters:
        size - Size of the Cache
        Throws:
        SQLException
      • setStmtCacheSize

        public void setStmtCacheSize​(int size,
                                     boolean clearMetaData)
                              throws SQLException
        Deprecated.
        Set the statement cache size. Default is 0. You cannot call this for logicalhandles obtained from PooledConnections.

        If more than <it> size </it> cursors are already cached than they will be closed. By default, the meta data of the cursor will be saved. But if clearMetaData is set to true, even that will be cleared. You need to call this first to enable either type of Statement caching. When both types of Statement caching are enabled, the <it> size </size> is the total number of cursors cached for both the schemes together.

        Parameters:
        size - Size of the Cache
        clearMetaData - Whether the state has to be cleared or not
        Throws:
        SQLException
      • getStmtCacheSize

        public int getStmtCacheSize()
        Deprecated.
        Return the size of Statement Cache.
        Returns:
        int Size of Statement Cache. If not set, the default 0 is returned.
      • setStatementCacheSize

        public void setStatementCacheSize​(int size)
                                   throws SQLException
        setStatementCacheSize Specifies the size of the size of the application cache (which will be used by both implicit and explicit caching).
        Specified by:
        setStatementCacheSize in interface OraclePooledConnection
        Parameters:
        size - Requested size of the cache. If the existing cache size is less than size, statements will be purged to reduce the size.
        Throws:
        SQLException - if size < 0, or if called on a logical connection.
      • setImplicitCachingEnabled

        public void setImplicitCachingEnabled​(boolean cache)
                                       throws SQLException
        setImplicitCachingEnabled Enables or disables the implicit cache. Note that this is independent of the cache size, set with setStatmentCacheSize().
        Specified by:
        setImplicitCachingEnabled in interface OraclePooledConnection
        Parameters:
        cache - If true, then implicit caching will be enabled. If false, then any existing statements will be purged and the implicit cache will be disabled.
        Throws:
        SQLException - if called on a logical connection.
      • setExplicitCachingEnabled

        public void setExplicitCachingEnabled​(boolean cache)
                                       throws SQLException
        setExplicitCachingEnabled Enables or disables the explicit cache. Note that this is independent of the cache size, set with setStatmentCacheSize().
        Specified by:
        setExplicitCachingEnabled in interface OraclePooledConnection
        Parameters:
        cache - If true, then explicit caching will be enabled. If false, then any existing statements will be purged and the explicit cache will be disabled.
        Throws:
        SQLException - if called on a logical connection.
      • purgeImplicitCache

        public void purgeImplicitCache()
                                throws SQLException
        purgeImplicitCache Removes all existing statements from the implicit cache, after which it will be empty. This method does not affect the size of the application cache, nor the enabled/disabled status.
        Specified by:
        purgeImplicitCache in interface OraclePooledConnection
        Throws:
        SQLException
      • purgeExplicitCache

        public void purgeExplicitCache()
                                throws SQLException
        purgeExplicitCache Removes all existing statements from the explicit cache, after which it will be empty. This method does not affect the size of the application cache, nor the enabled/disabled status.
        Specified by:
        purgeExplicitCache in interface OraclePooledConnection
        Throws:
        SQLException
      • getStatementWithKey

        public PreparedStatement getStatementWithKey​(String key)
                                              throws SQLException
        getStatementWithKey Searches the explicit cache for a match on key. If found, the statement is returned, with the paramater and define metadata identical to the last usage. If a CallableStatement is found (instead of a PreparedStatement, ORA-17125 is raised. If no match is found, or if explicit caching is not enabled, null is returned.
        Specified by:
        getStatementWithKey in interface OraclePooledConnection
        Parameters:
        key - Specified key to search for
        Throws:
        SQLException
      • getCallWithKey

        public CallableStatement getCallWithKey​(String key)
                                         throws SQLException
        getCallWithKey Searches the explicit cache for a match on key. If found, the statement is returned, with the paramater and define metadata identical to the last usage. If a PreparedStatement is found (instead of a CallableStatement, ORA-17125 is raised. If no match is found, or if explicit caching is not enabled, null is returned.
        Specified by:
        getCallWithKey in interface OraclePooledConnection
        Parameters:
        key - Specified key to search for
        Throws:
        SQLException
      • isStatementCacheInitialized

        public boolean isStatementCacheInitialized()
      • setProperties

        public final void setProperties​(Hashtable prop)
      • setConnection

        public void setConnection​(oracle.jdbc.internal.OracleConnection rconn)
                           throws SQLException
        Throws:
        SQLException
      • setShardingKeyIfValid

        public boolean setShardingKeyIfValid​(OracleShardingKey shardingKey,
                                             OracleShardingKey superShardingKey,
                                             int timeout)
                                      throws SQLException
        Checks the validity of the connection and also checks if the sharding keys passed to this method are valid for the connection.If the sharding keys are valid, it will be set on the connection's session.
        Specified by:
        setShardingKeyIfValid in interface OraclePooledConnection
        Parameters:
        shardingKey - Sharding key to be validated against this connection
        superShardingKey - Super Sharding key to be validated against this connection
        timeout - Time in seconds before which the validation process is expected to be complete, else the validation process is aborted. The value of the timeout must be set to zero to disable the timeout during the validation.
        Returns:
        true if the connection is valid and the shard keys are valid to be set on this connection.
        Throws:
        SQLException - if there is any exception while performing this validation or if timeout value is less than 0.
      • setShardingKey

        public void setShardingKey​(OracleShardingKey shardingKey,
                                   OracleShardingKey superShardingKey)
                            throws SQLException
        Sets the sharding key and the super sharding key on this connection.
        Specified by:
        setShardingKey in interface OraclePooledConnection
        Parameters:
        shardingKey - sharding key to be set on this connection
        superShardingKey - Super Sharding key to be set on this connection
        Throws:
        SQLException - if there is an exception while setting the sharding keys on this connection.
      • getConnectionDuringExceptionHandling

        protected oracle.jdbc.internal.OracleConnection getConnectionDuringExceptionHandling()
      • getMonitorLock

        public final oracle.jdbc.internal.Monitor.CloseableLock getMonitorLock()
        Specified by:
        getMonitorLock in interface oracle.jdbc.internal.Monitor
    </section>