public class OraclePooledConnection extends Object implements OraclePooledConnection, Serializable, oracle.jdbc.internal.Monitor
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
Modifier and Type | Field and Description |
---|---|
protected boolean |
autoCommit |
static String |
close_callback_string |
int |
closeOption |
static String |
connect_auto_commit_string |
static String |
connection_properties_string |
static String |
event_listener_string |
static String |
explicit_caching_enabled |
static String |
ExplicitStatementCachingEnabled |
static String |
implicit_caching_enabled |
static String |
ImplicitStatementCachingEnabled |
static String |
isClearMetaData |
protected oracle.jdbc.internal.OracleConnection |
logicalHandle |
static String |
LoginTimeout |
static String |
NO_IMPLICIT_BEGIN_REQUEST_PROPERTY |
static String |
object_type_map |
protected oracle.jdbc.driver.OracleDriver |
oracleDriver |
protected oracle.jdbc.internal.OracleConnection |
physicalConn |
static String |
pool_auto_commit_string |
static String |
private_data |
protected oracle.jdbc.internal.OracleConnection |
replayConn |
static String |
sql_exception_string |
static String |
statement_cache_size |
static String |
transaction_isolation |
static String |
url_string |
Constructor and Description |
---|
OraclePooledConnection() |
OraclePooledConnection(Connection pc)
Create a Pooled Connection.
|
OraclePooledConnection(Connection pc,
boolean ac)
Create a Pooled Connection.
|
OraclePooledConnection(String url)
Creates a PooledConnection.
|
OraclePooledConnection(String url,
String user,
String passwd)
Creates a PooledConnection.
|
Modifier and Type | Method and 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()
Deprecated.
|
Connection |
getLogicalHandle()
Return the logical handle to the caller.
|
oracle.jdbc.internal.Monitor.CloseableLock |
getMonitorLock() |
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)
Deprecated.
|
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)
Deprecated.
|
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 int closeOption
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
@Deprecated public void setLastAccessedTime(long lastAccessedTime) throws SQLException
setLastAccessedTime
in interface OraclePooledConnection
SQLException
@Deprecated public long getLastAccessedTime() throws SQLException
getLastAccessedTime
in interface OraclePooledConnection
SQLException
@Deprecated public void registerImplicitCacheConnectionEventListener(ConnectionEventListener cel)
registerImplicitCacheConnectionEventListener
in interface OraclePooledConnection
public void removeConnectionEventListener(ConnectionEventListener cel)
Remove an event listener.
removeConnectionEventListener
in interface PooledConnection
cel
- The listener to be removed.public void setStmtCacheSize(int size) throws SQLException
If more than
size
- Size of the CacheSQLException
public void setStmtCacheSize(int size, boolean clearMetaData) throws SQLException
If more than
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)
public final oracle.jdbc.internal.Monitor.CloseableLock getMonitorLock()
getMonitorLock
in interface oracle.jdbc.internal.Monitor