Package oracle.jdbc.datasource
Interface OraclePooledConnection
- All Superinterfaces:
PooledConnection
- All Known Subinterfaces:
OracleXAConnection
- All Known Implementing Classes:
OraclePooledConnection,OracleXAConnection,OracleXAConnection,OracleXAHeteroConnection
This interface defines the Oracle extensions to the standard JDBC interface
PooledConnection.- Since:
- 12.2
-
Method Summary
Modifier and TypeMethodDescriptiongetCallWithKey(String key) Searches the explicit cache for a match on key.booleanChecks if explicit cache is currently enabled.booleanChecks if implicit cache is currently enabled.longDeprecated.The Implicit Connection Cache (ICC) has been desupported since 12.1.Return the logical handle to the caller.intReturns the current size of the application cache.Searches the explicit cache for a match on key.Return an XA resource to the caller.voidRemoves all existing statements from the explicit cache, after which it will be empty.voidRemoves all existing statements from the implicit cache, after which it will be empty.voidregisterCloseCallback(oracle.jdbc.driver.OracleCloseCallback occ, Object privData) Registers a close callback.voidDeprecated.The Implicit Connection Cache (ICC) has been desupported since 12.1.voidsetExplicitCachingEnabled(boolean cache) Enables or disables the explicit cache.voidsetImplicitCachingEnabled(boolean cache) Enables or disables the implicit cache.voidsetLastAccessedTime(long lastAccessedTime) Deprecated.The Implicit Connection Cache (ICC) has been desupported since 12.1.voidsetShardingKey(OracleShardingKey shardingKey, OracleShardingKey superShardingKey) Sets the sharding key and the super sharding key on this connection.booleansetShardingKeyIfValid(OracleShardingKey shardingKey, OracleShardingKey superShardingKey, int timeout) 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.voidsetStatementCacheSize(int size) Specifies the size of the size of the application cache (which will be used by both implicit and explicit caching).Methods inherited from interface javax.sql.PooledConnection
addConnectionEventListener, addStatementEventListener, close, getConnection, removeConnectionEventListener, removeStatementEventListener
-
Method Details
-
getLogicalHandle
Return the logical handle to the caller. This logical handle refers to the physical connection that is pooled.
- Returns:
- a Connection object
- Throws:
SQLException
-
setLastAccessedTime
Deprecated.The Implicit Connection Cache (ICC) has been desupported since 12.1. This method throws UnsupportedOperationException, and will be removed soon in the future.- Throws:
SQLException
-
getLastAccessedTime
Deprecated.The Implicit Connection Cache (ICC) has been desupported since 12.1. This method throws UnsupportedOperationException, and will be removed soon in the future.- Throws:
SQLException
-
registerCloseCallback
Registers a close callback.
- Parameters:
occ- The callback to be registered.privData- Private data object to be passed to the callback.
-
registerImplicitCacheConnectionEventListener
Deprecated.The Implicit Connection Cache (ICC) has been desupported since 12.1. This method throws UnsupportedOperationException, and will be removed soon in the future. -
setStatementCacheSize
Specifies the size of the size of the application cache (which will be used by both implicit and explicit caching).- 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.
-
getStatementCacheSize
Returns the current size of the application cache. This is valid on both physical and logical connections.- Throws:
SQLException
-
setImplicitCachingEnabled
Enables or disables the implicit cache. Note that this is independent of the cache size, set with setStatementCacheSize().- 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.
-
getImplicitCachingEnabled
Checks if implicit cache is currently enabled. Returns true if the implicit cache is currently enabled, false otherwise. This method is valid on both logical and physical connections.- Throws:
SQLException
-
setExplicitCachingEnabled
Enables or disables the explicit cache. Note that this is independent of the cache size, set with setStatementCacheSize().- 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.
-
getExplicitCachingEnabled
Checks if explicit cache is currently enabled. Returns true if the explicit cache is currently enabled, false otherwise. This method is valid on both logical and physical connections.- 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.- 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.- Throws:
SQLException
-
getStatementWithKey
Searches the explicit cache for a match on key. If found, the statement is returned, with the parameter 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.- Parameters:
key- Specified key to search for- Throws:
SQLException
-
getCallWithKey
Searches the explicit cache for a match on key. If found, the statement is returned, with the parameter 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.- Parameters:
key- Specified key to search for- Throws:
SQLException
-
getXAResource
Return an XA resource to the caller. This is just a placeholder. Only the one on XAConnection is meaningful.- Returns:
- the XAResource (null if error occurs)
- Throws:
SQLException- if a database error occurs
-
setShardingKeyIfValid
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.- Parameters:
shardingKey- Sharding key to be validated against this connectionsuperShardingKey- Super Sharding key to be validated against this connectiontimeout- 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
void setShardingKey(OracleShardingKey shardingKey, OracleShardingKey superShardingKey) throws SQLException Sets the sharding key and the super sharding key on this connection.- Parameters:
shardingKey- sharding key to be set on this connectionsuperShardingKey- Super Sharding key to be set on this connection- Throws:
SQLException- if there is an exception while setting the sharding keys on this connection.
-