Package oracle.jdbc.pool
Class OracleOCIConnectionPool
java.lang.Object
oracle.jdbc.datasource.impl.OracleDataSource
oracle.jdbc.pool.OracleDataSource
oracle.jdbc.pool.OracleOCIConnectionPool
- All Implemented Interfaces:
Serializable,Wrapper,Referenceable,CommonDataSource,DataSource,OracleCommonDataSource,OracleDataSource,oracle.jdbc.diagnostics.Diagnosable,oracle.jdbc.diagnostics.PropertyChangeListener,oracle.jdbc.internal.Monitor,oracle.jdbc.replay.internal.OracleDataSource,OracleDataSource
A type-2 driver connection pool.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface oracle.jdbc.internal.Monitor
oracle.jdbc.internal.Monitor.CloseableLock, oracle.jdbc.internal.Monitor.WaitableMonitor -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringoracle.jdbc.oci.OracleOCIConnectionprotected intprotected booleanstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class oracle.jdbc.datasource.impl.OracleDataSource
CHECKSUM_PROPERTY, clientChecksum11203x, clientChecksum12x, connectionProperties, databaseName, dataSourceName, DEFAULT_SERVICE_NAME, description, DMS_DEFAULT_DATASOURCE_NAME, DMS_ROOT_NAME, doneDumpOnMemoryPressure, driver, driverType, ENABLE_AC_SUPPORT_PROPERTY, ENABLE_SSS_CURSOR_SUPPORT_PROPERTY, explicitCachingEnabled, explicitCachingEnabledSet, FAILOVER_RESTORE_AUTO, FAILOVER_RESTORE_LEVEL1, FAILOVER_RESTORE_LEVEL2, FAILOVER_RESTORE_NONE, FAILOVER_RESTORE_PROPERTY, FAILOVER_TYPE_AUTO, FAILOVER_TYPE_ON_REMOTE, FAILOVER_TYPE_PROPERTY, FAILOVER_TYPE_TRANSACTION, IGNORE_AC_CONTEXT_PROPERTY, implicitCachingEnabled, implicitCachingEnabledSet, INITIATION_TIMEOUT_PROPERTY, isAutoACEnabled, isFirstConnection, isHybrid, isOracleDataSource, isReplayInDynamicMode, isSSSCursorEnabled, isStateRestorationAuto, isTransactionReplayEnabled, loginTimeout, logWriter, maxStatements, maxStatementsSet, networkProtocol, password, portNumber, RECONNECT_DELAY_PROPERTY, RECONNECT_RETRIES_PROPERTY, reconnectDelay, reconnectRetries, replayInitiationTimeout, REQUEST_SIZE_LIMIT_PROPERTY, serverName, serviceName, SESSION_STATE_CONSISTENCY_HYBRID, SESSION_STATE_CONSISTENCY_STATIC, SESSION_STATE_PROPERTY, stateRestorationType, tnsEntry, TRACE, trackerInitialized, unnamedInstanceCount, url, userFields inherited from interface oracle.jdbc.replay.OracleDataSource
CONNECTION_PROPERTIES, DATA_SOURCE_NAME, DATABASE_NAME, DESCRIPTION, EXPLICIT_CACHING_ENABLED, IMPLICIT_CACHING_ENABLED, MAX_STATEMENTS, NETWORK_PROTOCOL, PASSWORD, PORT_NUMBER, ROLE_NAME, SERVER_NAME, URL, USER -
Constructor Summary
ConstructorsConstructorDescriptionThis 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 an userid and password that can act as proxy for the users in the getProxyConnection() method. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This will destroy the connection pool, and close all the connections opened from this data source.voidconnectionClosed(oracle.jdbc.oci.OracleOCIConnection conn) intReturn 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.OracleConnectiongetAliasedConnection(byte[] conId) For creating aliased sessions.Attempt to establish a database connection.getConnection(String us, String p) For getting a connection to the database.protected oracle.jdbc.internal.OracleConnectionintReturn the Increment for increasing the connections for the Cache.intReturn the Max limit on Connections.intNote: 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.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.intReturn 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.OracleConnectiongetProxyConnection(String proxytype, Properties prop) For creating a proxy connection.Inherited from referencableintReturn the size of Statement Cache.intReturn 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.booleanbooleancheck if the pool has been created.booleanCheck whether Statement Caching is enabled for this pool or Not.static voidreadPoolConfig(int minLimit, int maxLimit, int increment, int timeout, boolean nowait, boolean transactionsDistributed, int[] p) read the properties into an integer arraystatic voidreadPoolConfig(Properties info, int[] p) voidsetPoolConfig(Properties prop) (Re-)Set the pool configuration for the Cache.voidsetStmtCacheSize(int size) Set the statement cache size.voidsetStmtCacheSize(int size, boolean clearMetaData) Set the statement cache size.Methods inherited from class oracle.jdbc.datasource.impl.OracleDataSource
addRefProperties, cleanup, clearDoneDumpOnMemoryPressure, clearReplayStatistics, createConnectionBuilder, dms_data_source_type, enableACAndProxifyIfNecessary, finalize, getConnection, getConnection, getConnectionInitializationCallback, getConnectionNoProxy, getConnectionProperties, getConnectionProperty, getDatabaseName, getDataSourceName, getDescription, getDiagnosable, getDriverType, getExplicitCachingEnabled, getImplicitCachingEnabled, getLoginTimeout, getLogWriter, getMaxStatements, getMonitorLock, getNetworkProtocol, getParentLogger, getPassword, getPhysicalConnection, getPortNumber, getProxyFactory, getReplayStatistics, getReplayStatisticsString, getRequestSizeLimit, getRoleName, getServerName, getServiceName, getSSSCursorProperty, getSystemProperty, getTNSEntryName, getURL, getUser, isWrapperFor, makeURL, registerConnectionInitializationCallback, registerMBean, removeReplayStatistics, setConnectionProperties, setConnectionProperty, setDatabaseName, setDataSourceName, setDescription, setDriverType, setExplicitCachingEnabled, setHostnameResolver, setImplicitCachingEnabled, setLoginTimeout, setLogWriter, setMaxStatements, setNetworkProtocol, setPassword, setPortNumber, setRoleName, setServerName, setServiceName, setSingleShardTransactionSupport, setSSLContext, setTNSEntryName, setTokenSupplier, setupACSpecificProperties, setURL, setUser, unregisterConnectionInitializationCallback, unregisterMBean, unwrap, updateReplayStatisticsMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface oracle.jdbc.diagnostics.Diagnosable
begin, beginCurrentSql, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debugp, end, endCurrentSql, format, isDebugEnabled, isDiagnoseFirstFailureEnabled, isLoggable, isSensitiveEnabled, onClose, propertyChange, resumeLogging, secure, suspendLogging, trace, tracepMethods inherited from interface oracle.jdbc.internal.Monitor
acquireCloseableLock, acquireLock, assertLockHeldByCurrentThread, isReentrantLock, releaseLockMethods inherited from interface oracle.jdbc.datasource.OracleCommonDataSource
createShardingKeyBuilder
-
Field Details
-
m_connection_pool
public oracle.jdbc.oci.OracleOCIConnection m_connection_pool -
IS_CONNECTION_POOLING
- See Also:
-
CONNPOOL_OBJECT
- See Also:
-
CONNPOOL_LOGON_MODE
- See Also:
-
CONNECTION_POOL
- See Also:
-
CONNPOOL_CONNECTION
- See Also:
-
CONNPOOL_PROXY_CONNECTION
- See Also:
-
CONNPOOL_ALIASED_CONNECTION
- See Also:
-
PROXY_USER_NAME
- See Also:
-
PROXY_DISTINGUISHED_NAME
- See Also:
-
PROXY_CERTIFICATE
- See Also:
-
PROXY_ROLES
- See Also:
-
PROXY_NUM_ROLES
- See Also:
-
PROXY_PASSWORD
- See Also:
-
PROXYTYPE
- See Also:
-
PROXYTYPE_USER_NAME
- See Also:
-
PROXYTYPE_DISTINGUISHED_NAME
- See Also:
-
PROXYTYPE_CERTIFICATE
- See Also:
-
CONNECTION_ID
- See Also:
-
CONNPOOL_MIN_LIMIT
- See Also:
-
CONNPOOL_MAX_LIMIT
- See Also:
-
CONNPOOL_INCREMENT
- See Also:
-
CONNPOOL_ACTIVE_SIZE
- See Also:
-
CONNPOOL_POOL_SIZE
- See Also:
-
CONNPOOL_TIMEOUT
- See Also:
-
CONNPOOL_NOWAIT
- See Also:
-
CONNPOOL_IS_POOLCREATED
- See Also:
-
TRANSACTIONS_DISTRIBUTED
- See Also:
-
m_stmtCacheSize
protected int m_stmtCacheSize -
m_stmtClearMetaData
protected boolean m_stmtClearMetaData
-
-
Constructor Details
-
OracleOCIConnectionPool
public OracleOCIConnectionPool(String us, String p, String url, Properties info) throws SQLException Notes: Choose an userid and password that can act as proxy for the users in the getProxyConnection() method.- Parameters:
us- ConnectionPool user-id.p- ConnectionPool passwordurl- 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
Deprecated.- Throws:
SQLException
-
OracleOCIConnectionPool
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 an userid and password that can act as proxy for the users in the getProxyConnection() method.
- Throws:
SQLException
-
-
Method Details
-
getConnection
Description copied from class:OracleDataSourceAttempt to establish a database connection.
- Specified by:
getConnectionin interfaceDataSource- Overrides:
getConnectionin classOracleDataSource- Returns:
- a Connection to the database
- Throws:
SQLException- if a database-access error occurs.
-
getConnection
For getting a connection to the database.- Specified by:
getConnectionin interfaceDataSource- Overrides:
getConnectionin classOracleDataSource- Parameters:
us- Connection user-idp- Connection password- Returns:
- a Connection to the database
- Throws:
SQLException- if a database-access error occurs.
-
getReference
Inherited from referencable- Specified by:
getReferencein interfaceReferenceable- Overrides:
getReferencein classOracleDataSource- 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 username 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 proxyUserproxyUser- The user, or certificate, to be proxied against.roles- Set of roles which this proxy connection can use- Returns:
- connection object
- Throws:
SQLException
-
getAliasedConnection
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
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.- Throws:
SQLException
-
setPoolConfig
(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
-
getPoolConfig
- Throws:
SQLException
-
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. This should be used only as estimate and perhaps for statistical analysis.- Returns:
- Throws:
SQLException
-
getPoolSize
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
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
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
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
Return the Max limit on Connections.- Returns:
- int Max no of Connections that can be opened.
- Throws:
SQLException
-
getConnectionIncrement
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 whenis called with user/password or getConnection() has been called -
connectionClosed
- Throws:
SQLException
-
setStmtCacheSize
Set the statement cache size. Default is 0. You cannot set this for logicalhandles obtained from this pool. If more thansize cursors are already cached than they will be closed. By default, the metadata 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, thesize is the total number of cursors cached for both the schemes together. - Parameters:
size- Size of the Cache- Throws:
SQLException
-
setStmtCacheSize
Set the statement cache size. Default is 0. You cannot set this for logicalhandles obtained from this pool. If more thansize 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, thesize is the total number of cursors cached for both the schemes together. - Parameters:
size- Size of the CacheclearMetaData- 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:
getConnectionDuringExceptionHandlingin classOracleDataSource
-