public class OracleConnectionPoolDataSource extends OracleDataSource implements OracleConnectionPoolDataSource, oracle.jdbc.replay.internal.OracleConnectionPoolDataSource
A DataSource
object is a factory for Connection
objects.
An object that implements the DataSource
interface will typically
be registered with a JNDI service provider. A JDBC driver that is
accessed via the DataSource
API does not automatically register
itself with the DriverManager
.
This data source implements the standard JDBC
javax.sql.OracleConnectionPoolDataSource
and
the Oracle JDBC extension
oracle.jdbc.datasource.OracleConnectionPoolDataSource
interfaces.
This data Source also supports Application Continuity (AC) and
transparent JDBC operation replay upon a failover. To disable
such feature, set "oracle.jdbc.enableACSupport"
to false either
as a Java system property, or as a connection property on this
data source.
For most common scenarios, use
oracle.jdbc.datasource.impl.OracleDataSource
, instead of this class.
This class is reserved for connection pool developers who build their
pools using javax.sql.PooledConnection
.
For those developers, we strongly recommend to use this data source,
instead of older ones, like
oracle.jdbc.pool.OracleConnectionPoolDataSource
, or
oracle.jdbc.replay.OracleConnectionPoolDataSourceImpl
.
This applies to both standalone and application container use cases.
The following example illustrates the use of this data source to
create a JDBC PooledConnection
:
oracle.jdbc.datasource.OracleConnectionPoolDataSource ocpds =
new oracle.jdbc.datasource.impl.OracleConnectionPoolDataSource();
ocpds.setURL("jdbc:oracle:thin:@//dbhost:dbport/dbservice");
ocpds.setUser("User");
ocpds.setPassword("Passwd");
ocpds.setConnectionProperty("connProp1", "value1");
ocpds.setConnectionProperty("connProp2", "value2");
javax.sql.PooledConnection pc = ocpds.getPooledConnection();
The following example illustrates the use of a connection obtained from this data source for Application Continuity protection:
PooledConnection pc = rcpds.getPooledConnection();
Connection conn = pc.getConnection(); // Implicit request begin
...... // JDBC calls protected by Application Continuity
conn.close(); // Implicit request end
oracle.jdbc.datasource
,
oracle.jdbc.datasource.impl
,
Serialized FormCHECKSUM_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, user
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 and Description |
---|
OracleConnectionPoolDataSource() |
Modifier and Type | Method and Description |
---|---|
OraclePooledConnectionBuilder |
createPooledConnectionBuilder()
Creates a new
OraclePooledConnectionBuilder instance |
java.sql.Connection |
getConnection()
Attempt to establish a database connection.
|
java.sql.Connection |
getConnection(java.util.Properties props) |
java.sql.Connection |
getConnection(java.lang.String usr,
java.lang.String pwd)
Attempt to establish a database connection.
|
protected java.sql.Connection |
getPhysicalConnection()
Get a Physical Connection with default url, user name, and password
|
protected java.sql.Connection |
getPhysicalConnection(java.lang.String _user,
oracle.jdbc.internal.OpaqueString _passwd)
Get a Physical Connection with the user name and password & default URL
|
protected java.sql.Connection |
getPhysicalConnection(java.lang.String _user,
java.lang.String _passwd)
Get a Physical Connection with the user name and password & default URL
|
protected java.sql.Connection |
getPhysicalConnection(java.lang.String _url,
java.lang.String _user,
oracle.jdbc.internal.OpaqueString _passwd)
Get a Physical Connection with the given url, user name, and password
|
protected java.sql.Connection |
getPhysicalConnection(java.lang.String _url,
java.lang.String _user,
java.lang.String _passwd)
Get a Physical Connection with the given url, user name, and password
|
javax.sql.PooledConnection |
getPooledConnection()
Attempt to establish a database connection.
|
protected OraclePooledConnection |
getPooledConnection(OracleConnectionBuilderImpl connBuilder) |
javax.sql.PooledConnection |
getPooledConnection(java.lang.String _user,
java.lang.String _password)
Attempt to establish a database connection.
|
addRefProperties, cleanup, clearDoneDumpOnMemoryPressure, clearReplayStatistics, createConnectionBuilder, dms_data_source_type, enableACAndProxifyIfNecessary, finalize, getConnection, getConnection, getConnectionDuringExceptionHandling, getConnectionInitializationCallback, getConnectionNoProxy, getConnectionProperties, getConnectionProperty, getDatabaseName, getDataSourceName, getDescription, getDiagnosable, getDriverType, getExplicitCachingEnabled, getImplicitCachingEnabled, getLoginTimeout, getLogWriter, getMaxStatements, getMonitorLock, getNetworkProtocol, getParentLogger, getPassword, getPhysicalConnection, getPortNumber, getProxyFactory, getReference, 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, updateReplayStatistics
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearDoneDumpOnMemoryPressure, getConnectionNoProxy, getProxyFactory, getReplayStatisticsString, getRequestSizeLimit, removeReplayStatistics, updateReplayStatistics
clearReplayStatistics, getConnectionInitializationCallback, getExplicitCachingEnabled, getImplicitCachingEnabled, getMaxStatements, getReplayStatistics, getRoleName, registerConnectionInitializationCallback, setExplicitCachingEnabled, setImplicitCachingEnabled, setMaxStatements, setRoleName, unregisterConnectionInitializationCallback
createConnectionBuilder, setExecutorService
getLoginTimeout, getLogWriter, getParentLogger, setLoginTimeout, setLogWriter
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, tracep
public OracleConnectionPoolDataSource() throws java.sql.SQLException
java.sql.SQLException
public javax.sql.PooledConnection getPooledConnection() throws java.sql.SQLException
Attempt to establish a database connection.
getPooledConnection
in interface javax.sql.ConnectionPoolDataSource
java.sql.SQLException
- if a database-access error occurs.public javax.sql.PooledConnection getPooledConnection(java.lang.String _user, java.lang.String _password) throws java.sql.SQLException
Attempt to establish a database connection.
getPooledConnection
in interface javax.sql.ConnectionPoolDataSource
user
- the database user on whose behalf the Connection is
being madepassword
- the user's passwordjava.sql.SQLException
- if a database-access error occurs.protected java.sql.Connection getPhysicalConnection() throws java.sql.SQLException
java.sql.SQLException
protected java.sql.Connection getPhysicalConnection(java.lang.String _url, java.lang.String _user, java.lang.String _passwd) throws java.sql.SQLException
java.sql.SQLException
protected java.sql.Connection getPhysicalConnection(java.lang.String _user, java.lang.String _passwd) throws java.sql.SQLException
java.sql.SQLException
protected java.sql.Connection getPhysicalConnection(java.lang.String _url, java.lang.String _user, oracle.jdbc.internal.OpaqueString _passwd) throws java.sql.SQLException
java.sql.SQLException
protected java.sql.Connection getPhysicalConnection(java.lang.String _user, oracle.jdbc.internal.OpaqueString _passwd) throws java.sql.SQLException
java.sql.SQLException
protected OraclePooledConnection getPooledConnection(OracleConnectionBuilderImpl connBuilder) throws java.sql.SQLException
java.sql.SQLException
public OraclePooledConnectionBuilder createPooledConnectionBuilder() throws java.sql.SQLException
OracleConnectionPoolDataSource
OraclePooledConnectionBuilder
instancecreatePooledConnectionBuilder
in interface OracleConnectionPoolDataSource
OraclePooledConnectionBuilder
instance that was createdjava.sql.SQLException
- if an error occurs while creating the builderpublic java.sql.Connection getConnection() throws java.sql.SQLException
OracleDataSource
Attempt to establish a database connection.
getConnection
in interface javax.sql.DataSource
getConnection
in class OracleDataSource
java.sql.SQLException
- if a database-access error occurs.public java.sql.Connection getConnection(java.lang.String usr, java.lang.String pwd) throws java.sql.SQLException
OracleDataSource
Attempt to establish a database connection.
getConnection
in interface javax.sql.DataSource
getConnection
in class OracleDataSource
usr
- the database user on whose behalf the Connection is
being madepwd
- the user's passwordjava.sql.SQLException
- if a database-access error occurs.public java.sql.Connection getConnection(java.util.Properties props) throws java.sql.SQLException
java.sql.SQLException