Serializable
, PooledConnection
, OraclePooledConnection
OracleXAConnection
public class OraclePooledConnection extends Object implements OraclePooledConnection, Serializable
An OraclePooledConnection object is a connection object that provides hooks for connection pool management. A PooledConnection object represents a physical connection to a data source. It implements javax.sql.PooledConnection
Constructor | Description |
---|---|
OraclePooledConnection() |
|
OraclePooledConnection(String url) |
Creates a PooledConnection.
|
OraclePooledConnection(String url, String user, String passwd) |
Creates a PooledConnection.
|
OraclePooledConnection(Connection pc) |
Create a Pooled Connection.
|
OraclePooledConnection(Connection pc, boolean ac) |
Create a Pooled Connection.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addConnectionEventListener(ConnectionEventListener cel) |
Add an event listener.
|
void |
addStatementEventListener(StatementEventListener listener) |
|
void |
close() |
Close the physical connection.
|
protected void |
debug(Logger logger, Level level, Executable method, String msg) |
|
CallableStatement |
getCallWithKey(String key) |
getCallWithKey Searches the explicit cache for a match on key.
|
Connection |
getConnection() |
Create an object handle for this physical connection.
|
protected oracle.jdbc.internal.OracleConnection |
getConnectionDuringExceptionHandling() |
|
boolean |
getExplicitCachingEnabled() |
getExplicitCachingEnabled Returns true if the explicit cache is currently enabled, false otherwise.
|
boolean |
getImplicitCachingEnabled() |
getImplicitCachingEnabled Returns true if the implicit cache is currently enabled, false otherwise.
|
long |
getLastAccessedTime() |
Get the last accessed time on the PooledConnection.
|
Connection |
getLogicalHandle() |
Return the logical handle to the caller.
|
Connection |
getPhysicalHandle() |
|
int |
getStatementCacheSize() |
getStatementCacheSize Returns the current size of the application cache.
|
PreparedStatement |
getStatementWithKey(String key) |
getStatementWithKey Searches the explicit cache for a match on key.
|
int |
getStmtCacheSize() |
Deprecated.
|
XAResource |
getXAResource() |
Return an XA resource to the caller.
|
boolean |
isStatementCacheInitialized() |
|
void |
purgeExplicitCache() |
purgeExplicitCache Removes all existing statements from the explicit cache, after which it will be empty.
|
void |
purgeImplicitCache() |
purgeImplicitCache Removes all existing statements from the implicit cache, after which it will be empty.
|
void |
registerImplicitCacheConnectionEventListener(ConnectionEventListener cel) |
Register an event listener for the implicit connection cache.
|
void |
removeConnectionEventListener(ConnectionEventListener cel) |
Remove an event listener.
|
void |
removeStatementEventListener(StatementEventListener listener) |
|
void |
setConnection(oracle.jdbc.internal.OracleConnection rconn) |
|
void |
setExplicitCachingEnabled(boolean cache) |
setExplicitCachingEnabled Enables or disables the explicit cache.
|
void |
setImplicitCachingEnabled(boolean cache) |
setImplicitCachingEnabled Enables or disables the implicit cache.
|
void |
setLastAccessedTime(long lastAccessedTime) |
Set the last accessed time on the PooledConnection.
|
void |
setProperties(Hashtable prop) |
|
void |
setShardingKey(OracleShardingKey shardingKey, OracleShardingKey superShardingKey) |
Sets the sharding key and the super sharding key on this connection.
|
boolean |
setShardingKeyIfValid(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's session.
|
void |
setStatementCacheSize(int size) |
setStatementCacheSize Specifies the size of the size of the application cache (which will be used by both implicit and explicit caching).
|
void |
setStmtCacheSize(int size) |
Deprecated.
|
void |
setStmtCacheSize(int size, boolean clearMetaData) |
Deprecated.
|
public static final String url_string
public static final String pool_auto_commit_string
public static final String object_type_map
public static final String transaction_isolation
public static final String statement_cache_size
public static final String isClearMetaData
public static final String ImplicitStatementCachingEnabled
public static final String ExplicitStatementCachingEnabled
public static final String LoginTimeout
public static final String connect_auto_commit_string
public static final String implicit_caching_enabled
public static final String explicit_caching_enabled
public static final String connection_properties_string
public static final String event_listener_string
public static final String sql_exception_string
public static final String close_callback_string
public static final String private_data
protected boolean autoCommit
protected transient oracle.jdbc.internal.OracleConnection logicalHandle
protected transient oracle.jdbc.internal.OracleConnection physicalConn
protected transient oracle.jdbc.internal.OracleConnection replayConn
public Properties cachedConnectionAttributes
public Properties unMatchedCachedConnAttr
public int closeOption
protected String dataSourceInstanceNameKey
protected String dataSourceHostNameKey
protected String dataSourceDbUniqNameKey
protected boolean connectionMarkedDown
protected boolean needToAbort
protected transient oracle.jdbc.driver.OracleDriver oracleDriver
public static final String NO_IMPLICIT_BEGIN_REQUEST_PROPERTY
public OraclePooledConnection()
public OraclePooledConnection(String url) throws SQLException
Creates a PooledConnection.
url
- URL of the physical connection.SQLException
public OraclePooledConnection(String url, String user, String passwd) throws SQLException
Creates a PooledConnection.
url
- URL of the physical connection.user
- User Namepasswd
- PasswordSQLException
public OraclePooledConnection(Connection pc)
Create a Pooled Connection.
pc
- The corresponding physical connection.public OraclePooledConnection(Connection pc, boolean ac)
Create a Pooled Connection.
pc
- The corresponding physical connectionac
- autoCommit valuepublic void addConnectionEventListener(ConnectionEventListener cel)
Add an event listener.
addConnectionEventListener
in interface PooledConnection
cel
- The listener to be addedpublic void close() throws SQLException
Close the physical connection.
close
in interface PooledConnection
SQLException
- if a database-access error occurs.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.
getConnection
in interface PooledConnection
SQLException
- if a database-access error occurs.public Connection getLogicalHandle() throws SQLException
Return the logical handle to the caller. This logical handle refers to the physical connection that is pooled.
getLogicalHandle
in interface OraclePooledConnection
SQLException
public Connection getPhysicalHandle() throws SQLException
SQLException
public void setLastAccessedTime(long lastAccessedTime) throws SQLException
Set the last accessed time on the PooledConnection. This is used by the inactivity timeout thread
setLastAccessedTime
in interface OraclePooledConnection
lastAccessedTime
- , last accessed time in millisecondsSQLException
public long getLastAccessedTime() throws SQLException
Get the last accessed time on the PooledConnection. This is used by the inactivity timeout thread
getLastAccessedTime
in interface OraclePooledConnection
SQLException
public void removeConnectionEventListener(ConnectionEventListener cel)
Remove an event listener.
removeConnectionEventListener
in interface PooledConnection
cel
- The listener to be removed.public void registerImplicitCacheConnectionEventListener(ConnectionEventListener cel)
Register an event listener for the implicit connection cache.
registerImplicitCacheConnectionEventListener
in interface OraclePooledConnection
cel
- The listener to be registeredpublic void setStmtCacheSize(int size) throws SQLException
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.
size
- Size of the CacheSQLException
public void setStmtCacheSize(int size, boolean clearMetaData) throws SQLException
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.
size
- Size of the CacheclearMetaData
- Whether the state has to be cleared or notSQLException
public int getStmtCacheSize()
public void setStatementCacheSize(int size) throws SQLException
setStatementCacheSize
in interface OraclePooledConnection
size
- Requested size of the cache. If the existing cache size is less than size, statements will be purged to reduce the size.SQLException
- if size < 0, or if called on a logical connection.public int getStatementCacheSize() throws SQLException
getStatementCacheSize
in interface OraclePooledConnection
SQLException
public void setImplicitCachingEnabled(boolean cache) throws SQLException
setImplicitCachingEnabled
in interface OraclePooledConnection
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.SQLException
- if called on a logical connection.public boolean getImplicitCachingEnabled() throws SQLException
getImplicitCachingEnabled
in interface OraclePooledConnection
SQLException
public void setExplicitCachingEnabled(boolean cache) throws SQLException
setExplicitCachingEnabled
in interface OraclePooledConnection
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.SQLException
- if called on a logical connection.public boolean getExplicitCachingEnabled() throws SQLException
getExplicitCachingEnabled
in interface OraclePooledConnection
SQLException
public void purgeImplicitCache() throws SQLException
purgeImplicitCache
in interface OraclePooledConnection
SQLException
public void purgeExplicitCache() throws SQLException
purgeExplicitCache
in interface OraclePooledConnection
SQLException
public PreparedStatement getStatementWithKey(String key) throws SQLException
getStatementWithKey
in interface OraclePooledConnection
key
- Specified key to search forSQLException
public CallableStatement getCallWithKey(String key) throws SQLException
getCallWithKey
in interface OraclePooledConnection
key
- Specified key to search forSQLException
public boolean isStatementCacheInitialized()
public final void setProperties(Hashtable prop)
public XAResource getXAResource() throws SQLException
getXAResource
in interface OraclePooledConnection
SQLException
- if a database error occurspublic void addStatementEventListener(StatementEventListener listener)
addStatementEventListener
in interface PooledConnection
public void removeStatementEventListener(StatementEventListener listener)
removeStatementEventListener
in interface PooledConnection
public void setConnection(oracle.jdbc.internal.OracleConnection rconn) throws SQLException
SQLException
public boolean setShardingKeyIfValid(OracleShardingKey shardingKey, OracleShardingKey superShardingKey, int timeout) throws SQLException
setShardingKeyIfValid
in interface OraclePooledConnection
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.SQLException
- if there is any exception while performing this validation or if timeout value is less than 0.public void setShardingKey(OracleShardingKey shardingKey, OracleShardingKey superShardingKey) throws SQLException
setShardingKey
in interface OraclePooledConnection
shardingKey
- sharding key to be set on this connectionsuperShardingKey
- Super Sharding key to be set on this connectionSQLException
- if there is an exception while setting the sharding keys on this connection.protected oracle.jdbc.internal.OracleConnection getConnectionDuringExceptionHandling()
protected void debug(Logger logger, Level level, Executable method, String msg)