Skip navigation links

Oracle®Database JDBC Java API Reference
12c Release 1 (12.1.0.2)
E56669-01


oracle.jdbc.pool
Class OracleOCIConnectionPool

java.lang.Object
  extended by oracle.jdbc.pool.OracleDataSource
      extended by oracle.jdbc.pool.OracleOCIConnectionPool

All Implemented Interfaces:
Serializable, Wrapper, Referenceable, CommonDataSource, DataSource

public class OracleOCIConnectionPool
extends OracleDataSource

A type-2 driver connection pool.

See Also:
Serialized Form

Field Summary
static String CONNECTION_ID
           
static String CONNECTION_POOL
           
static String CONNPOOL_ACTIVE_SIZE
           
static String CONNPOOL_ALIASED_CONNECTION
           
static String CONNPOOL_CONNECTION
           
static String CONNPOOL_INCREMENT
           
static String CONNPOOL_IS_POOLCREATED
           
static String CONNPOOL_LOGON_MODE
           
static String CONNPOOL_MAX_LIMIT
           
static String CONNPOOL_MIN_LIMIT
           
static String CONNPOOL_NOWAIT
           
static String CONNPOOL_OBJECT
           
static String CONNPOOL_POOL_SIZE
           
static String CONNPOOL_PROXY_CONNECTION
           
static String CONNPOOL_TIMEOUT
           
static String IS_CONNECTION_POOLING
           
 oracle.jdbc.oci.OracleOCIConnection m_connection_pool
           
protected  int m_stmtCacheSize
           
protected  boolean m_stmtClearMetaData
           
static String PROXY_CERTIFICATE
           
static String PROXY_DISTINGUISHED_NAME
           
static String PROXY_NUM_ROLES
           
static String PROXY_PASSWORD
           
static String PROXY_ROLES
           
static String PROXY_USER_NAME
           
static String PROXYTYPE
           
static String PROXYTYPE_CERTIFICATE
           
static String PROXYTYPE_DISTINGUISHED_NAME
           
static String PROXYTYPE_USER_NAME
           
static boolean TRACE
           
static String TRANSACTIONS_DISTRIBUTED
           

 

Fields inherited from class oracle.jdbc.pool.OracleDataSource
cacheManager, connCacheName, connCacheProperties, connCachingEnabled, connectionProperties, databaseName, dataSourceName, description, driver, driverType, explicitCachingEnabled, explicitCachingEnabledSet, fastConnFailover, implicitCachingEnabled, implicitCachingEnabledSet, isOracleDataSource, loginTimeout, logWriter, maxStatements, maxStatementsSet, networkProtocol, odsCache, onsConfigStr, password, portNumber, serverName, serviceName, tnsEntry, url, user

 

Constructor Summary
OracleOCIConnectionPool()
          This will use the user-id, password and connection pool name values set using the methods setUser, setPassword, setConnectionPoolName.
OracleOCIConnectionPool(String us, String p, String url)
          Deprecated.  
OracleOCIConnectionPool(String us, String p, String url, Properties info)
          Notes: Choose a userid and password that can act as proxy for the users in the getProxyConnection() method.

 

Method Summary
 void close()
          This will destroy the connection pool, and close all the connections opened from this data source.
 void connectionClosed(oracle.jdbc.oci.OracleOCIConnection conn)
           
 int getActiveSize()
          Return the number of active or busy connections in the connection pool Note that the count cannot be guaranteed on any invoking subsequent OracleOCIConnectionCacheImpl method.
 oracle.jdbc.internal.OracleConnection getAliasedConnection(byte[] conId)
          For creating aliased sessions.
 Connection getConnection()
          Attempt to establish a database connection.
 Connection getConnection(String us, String p)
          For getting a connection to the database.
protected  oracle.jdbc.internal.OracleConnection getConnectionDuringExceptionHandling()
           
 int getConnectionIncrement()
          Return the Increment for increasing the connections for the Cache.
 int getMaxLimit()
          Return the Max limit on Connections.
 int getMinLimit()
          Note: There are no individual setMin, setMax and setIncrement since that needs to be done in one call to setPoolConfig Return the minimum limit on the no of Connections.
 String getNoWait()
          Return the connection No-wait parameter This attribute determines if retrial for a connection has to be done when all connections in the pool are found to be busy and the number of connections already reached max.
 Properties getPoolConfig()
           
 int getPoolSize()
          Return the number of physical connections in the connection pool Note that the count cannot be guaranteed on any invoking subsequent OracleOCIConnectionCacheImpl method.
 oracle.jdbc.internal.OracleConnection getProxyConnection(String proxytype, Properties prop)
          For creating a proxy connection.
 Reference getReference()
          Inherited from referenceable
 int getStmtCacheSize()
          Return the size of Statement Cache.
 int getTimeout()
          Return the timeout The connections idle for more than this time (seconds) are terminated periodically, to maintain optimum number of open connections.This attribute can be set dynamically.
 boolean isDistributedTransEnabled()
           
 boolean isPoolCreated()
          check if the pool has been created.
 boolean isStmtCacheEnabled()
          Check whether Statement Caching is enabled for this pool or Not.
static void readPoolConfig(int minLimit, int maxLimit, int increment, int timeout, boolean nowait, boolean transactionsDistributed, int[] p)
          read the properties into an integer array
static void readPoolConfig(Properties info, int[] p)
           
 void setPoolConfig(Properties prop)
          (Re-)Set the pool configuration for the Cache.
 void setStmtCacheSize(int size)
          Set the statement cache size.
 void setStmtCacheSize(int size, boolean clearMetaData)
          Set the statement cache size.

 

Methods inherited from class oracle.jdbc.pool.OracleDataSource
addRefProperties, copy, getConnection, getConnection, getConnectionCacheName, getConnectionCacheProperties, getConnectionCachingEnabled, getConnectionProperties, getDatabaseName, getDataSourceName, getDescription, getDriverType, getExplicitCachingEnabled, getFastConnectionFailoverEnabled, getImplicitCachingEnabled, getLoginTimeout, getLogWriter, getMaxStatements, getNetworkProtocol, getONSConfiguration, getParentLogger, getPassword, getPhysicalConnection, getPortNumber, getServerName, getServiceName, getTNSEntryName, getURL, getUser, isWrapperFor, setConnectionCacheName, setConnectionCacheProperties, setConnectionCachingEnabled, setConnectionProperties, setDatabaseName, setDataSourceName, setDescription, setDriverType, setExplicitCachingEnabled, setFastConnectionFailoverEnabled, setImplicitCachingEnabled, setLoginTimeout, setLogWriter, setMaxStatements, setNetworkProtocol, setONSConfiguration, setPassword, setPortNumber, setServerName, setServiceName, setTNSEntryName, setURL, setUser, trace, unwrap

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

m_connection_pool

public oracle.jdbc.oci.OracleOCIConnection m_connection_pool

IS_CONNECTION_POOLING

public static final String IS_CONNECTION_POOLING
See Also:
Constant Field Values

CONNPOOL_OBJECT

public static final String CONNPOOL_OBJECT
See Also:
Constant Field Values

CONNPOOL_LOGON_MODE

public static final String CONNPOOL_LOGON_MODE
See Also:
Constant Field Values

CONNECTION_POOL

public static final String CONNECTION_POOL
See Also:
Constant Field Values

CONNPOOL_CONNECTION

public static final String CONNPOOL_CONNECTION
See Also:
Constant Field Values

CONNPOOL_PROXY_CONNECTION

public static final String CONNPOOL_PROXY_CONNECTION
See Also:
Constant Field Values

CONNPOOL_ALIASED_CONNECTION

public static final String CONNPOOL_ALIASED_CONNECTION
See Also:
Constant Field Values

PROXY_USER_NAME

public static final String PROXY_USER_NAME
See Also:
Constant Field Values

PROXY_DISTINGUISHED_NAME

public static final String PROXY_DISTINGUISHED_NAME
See Also:
Constant Field Values

PROXY_CERTIFICATE

public static final String PROXY_CERTIFICATE
See Also:
Constant Field Values

PROXY_ROLES

public static final String PROXY_ROLES
See Also:
Constant Field Values

PROXY_NUM_ROLES

public static final String PROXY_NUM_ROLES
See Also:
Constant Field Values

PROXY_PASSWORD

public static final String PROXY_PASSWORD
See Also:
Constant Field Values

PROXYTYPE

public static final String PROXYTYPE
See Also:
Constant Field Values

PROXYTYPE_USER_NAME

public static final String PROXYTYPE_USER_NAME
See Also:
Constant Field Values

PROXYTYPE_DISTINGUISHED_NAME

public static final String PROXYTYPE_DISTINGUISHED_NAME
See Also:
Constant Field Values

PROXYTYPE_CERTIFICATE

public static final String PROXYTYPE_CERTIFICATE
See Also:
Constant Field Values

CONNECTION_ID

public static final String CONNECTION_ID
See Also:
Constant Field Values

CONNPOOL_MIN_LIMIT

public static final String CONNPOOL_MIN_LIMIT
See Also:
Constant Field Values

CONNPOOL_MAX_LIMIT

public static final String CONNPOOL_MAX_LIMIT
See Also:
Constant Field Values

CONNPOOL_INCREMENT

public static final String CONNPOOL_INCREMENT
See Also:
Constant Field Values

CONNPOOL_ACTIVE_SIZE

public static final String CONNPOOL_ACTIVE_SIZE
See Also:
Constant Field Values

CONNPOOL_POOL_SIZE

public static final String CONNPOOL_POOL_SIZE
See Also:
Constant Field Values

CONNPOOL_TIMEOUT

public static final String CONNPOOL_TIMEOUT
See Also:
Constant Field Values

CONNPOOL_NOWAIT

public static final String CONNPOOL_NOWAIT
See Also:
Constant Field Values

CONNPOOL_IS_POOLCREATED

public static final String CONNPOOL_IS_POOLCREATED
See Also:
Constant Field Values

TRANSACTIONS_DISTRIBUTED

public static final String TRANSACTIONS_DISTRIBUTED
See Also:
Constant Field Values

m_stmtCacheSize

protected int m_stmtCacheSize

m_stmtClearMetaData

protected boolean m_stmtClearMetaData

TRACE

public static final boolean TRACE
See Also:
Constant Field Values

Constructor Detail

OracleOCIConnectionPool

public OracleOCIConnectionPool(String us,
                               String p,
                               String url,
                               Properties info)
                        throws SQLException
Notes: Choose a userid and password that can act as proxy for the users in the getProxyConnection() method.
Parameters:
us - ConnectionPool user-id.
p - ConnectionPool password
url - This would be the full url including the database name. The database name would be the logical name of the pool.
info - Set of properties (optional) for specifying the pool configuration.
Throws:
SQLException

OracleOCIConnectionPool

public OracleOCIConnectionPool(String us,
                               String p,
                               String url)
                        throws SQLException
Deprecated. 
Throws:
SQLException

OracleOCIConnectionPool

public OracleOCIConnectionPool()
                        throws SQLException
This will use the user-id, password and connection pool name values set using the methods setUser, setPassword, setConnectionPoolName.

Notes: No useful operations (like getConnection) can be performed on this class unless the methods setUser, setPassword, setConnectionPoolName are invoked. Choose a userid and password that can act as proxy for the users in the getProxyConnection() method.

Throws:
SQLException

Method Detail

getConnection

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

Attempt to establish a database connection.

Specified by:
getConnection in interface DataSource
Overrides:
getConnection in class OracleDataSource
Returns:
a Connection to the database
Throws:
SQLException - if a database-access error occurs.

getConnection

public Connection getConnection(String us,
                                String p)
                         throws SQLException
For getting a connection to the database.
Specified by:
getConnection in interface DataSource
Overrides:
getConnection in class OracleDataSource
Parameters:
us - Connection user-id
p - Connection password
Returns:
a Connection to the database
Throws:
SQLException - if a database-access error occurs.

getReference

public Reference getReference()
                       throws NamingException
Inherited from referenceable
Specified by:
getReference in interface Referenceable
Overrides:
getReference in class OracleDataSource
Returns:
Returns a reference to this OracleOCIConnectionPool instance
Throws:
NamingException

getProxyConnection

public oracle.jdbc.internal.OracleConnection getProxyConnection(String proxytype,
                                                                Properties prop)
                                                         throws SQLException
For creating a proxy connection.

Notes: The user and password used to create OracleOCIConnectionPool() must be allowed to act as proxy for user 'us'.

Parameters:
proxytype - Can be one of following types OracleOCIConnectionPool.PROXYCONNECTION_USER_NAME - This will be the normal mode of specifying the user name in proxyUser OracleOCIConnectionPool.PROXYCONNECTION_DISTINGUISHED_NAME - This will specify the distinguished name of the user in proxyUser OracleOCIConnectionPool.PROXYCONNECTION_CERTIFICATE - This will specify the proxy certificate in proxyUser
proxyUser - The user, or certificate, to be proxied against.
roles - Set of roles which this proxy connection can use
Returns:
connection object
Throws:
SQLException

getAliasedConnection

public oracle.jdbc.internal.OracleConnection getAliasedConnection(byte[] conId)
                                                           throws SQLException
For creating aliased sessions.

Notes: Once this call is issued, this connection object can't be used for any operation, as the intent for connection cloning is failover.

Parameters:
conId - - byte[] of the connection id
Throws:
SQLException

close

public void close()
           throws SQLException
This will destroy the connection pool, and close all the connections opened from this data source. Hence all the statement objects created from these connection objects will also be closed.
Overrides:
close in class OracleDataSource
Throws:
SQLException

setPoolConfig

public void setPoolConfig(Properties prop)
                   throws SQLException
(Re-)Set the pool configuration for the Cache. Note: We will not be exposing set for individual settings of the pool's configuration. Users will have to call setPoolConfig with min, max & increment in order for the pool's configuration to be changed.
Parameters:
prop -
Throws:
SQLException

readPoolConfig

public static void readPoolConfig(int minLimit,
                                  int maxLimit,
                                  int increment,
                                  int timeout,
                                  boolean nowait,
                                  boolean transactionsDistributed,
                                  int[] p)
read the properties into an integer array

readPoolConfig

public static void readPoolConfig(Properties info,
                                  int[] p)

getPoolConfig

public Properties getPoolConfig()
                         throws SQLException
Throws:
SQLException

getActiveSize

public int getActiveSize()
                  throws SQLException
Return the number of active or busy connections in the connection pool Note that the count cannot be guaranteed on any invoking subsequent OracleOCIConnectionCacheImpl method. This should be used only as estimate and perhaps for statistical analysis.
Returns:
Throws:
SQLException

getPoolSize

public int getPoolSize()
                throws SQLException
Return the number of physical connections in the connection pool Note that the count cannot be guaranteed on any invoking subsequent OracleOCIConnectionCacheImpl method. This should be used only as estimate and perhaps for statistical analysis.
Returns:
Throws:
SQLException

getTimeout

public int getTimeout()
               throws SQLException
Return the timeout The connections idle for more than this time (seconds) are terminated periodically, to maintain optimum number of open connections.This attribute can be set dynamically. If this attribute is not set, the connections are never timed out.
Returns:
Throws:
SQLException

getNoWait

public String getNoWait()
                 throws SQLException
Return the connection No-wait parameter This attribute determines if retrial for a connection has to be done when all connections in the pool are found to be busy and the number of connections already reached max. If this attribute is set, an error is thrown when all the connections are busy and no more connections can be opened. Otherwise the call waits till it gets a connection.
Returns:
Throws:
SQLException

getMinLimit

public int getMinLimit()
                throws SQLException
Note: There are no individual setMin, setMax and setIncrement since that needs to be done in one call to setPoolConfig Return the minimum limit on the no of Connections.
Returns:
minimum limit on the no of Connections.
Throws:
SQLException

getMaxLimit

public int getMaxLimit()
                throws SQLException
Return the Max limit on Connections.
Returns:
int Max no of Connections that can be opened.
Throws:
SQLException

getConnectionIncrement

public int getConnectionIncrement()
                           throws SQLException
Return the Increment for increasing the connections for the Cache.
Returns:
int Increment
Throws:
SQLException

isDistributedTransEnabled

public boolean isDistributedTransEnabled()

isPoolCreated

public boolean isPoolCreated()
check if the pool has been created. This occurs when <init> is called with user/password or getConnection() has been called

connectionClosed

public void connectionClosed(oracle.jdbc.oci.OracleOCIConnection conn)
                      throws SQLException
Throws:
SQLException

setStmtCacheSize

public void setStmtCacheSize(int size)
                      throws SQLException
Set the statement cache size. Default is 0. You cannot set this for logicalhandles obtained from this pool. 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
Set the statement cache size. Default is 0. You cannot set this for logicalhandles obtained from this pool. 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()
Return the size of Statement Cache.
Returns:
int Size of Statement Cache. If not set, the default 0 is returned.

isStmtCacheEnabled

public boolean isStmtCacheEnabled()
Check whether Statement Caching is enabled for this pool or Not.

getConnectionDuringExceptionHandling

protected oracle.jdbc.internal.OracleConnection getConnectionDuringExceptionHandling()
Overrides:
getConnectionDuringExceptionHandling in class OracleDataSource

Skip navigation links

Oracle®Database JDBC Java API Reference
12c Release 1 (12.1.0.2)
E56669-01


Copyright © 2008, 2014, Oracle and/or its affiliates. All rights reserved.