public class OracleDataSource extends java.lang.Object implements OracleDataSource, Diagnosable, oracle.jdbc.replay.internal.OracleDataSource, java.io.Serializable, javax.naming.Referenceable, oracle.jdbc.internal.Monitor
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 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 data source creation using Oracle JDBC driver 21c and higher
versions, we strongly recommend to use this data source,
instead of older ones, like
oracle.jdbc.pool.OracleDataSource
, or
oracle.jdbc.replay.OracleDataSourceImpl
.
This applies to both standalone and application container use cases.
The following example illustrates the use of this data source to create a JDBC connection:
oracle.jdbc.datasource.OracleDataSource ods =
new oracle.jdbc.datasource.impl.OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//dbhost:dbport/dbservice");
ods.setUser("User");
ods.setPassword("Passwd");
ods.setConnectionProperty("connProp1", "value1");
ods.setConnectionProperty("connProp2", "value2");
Connection conn = ods.getConnection();
The following example illustrates the use of a connection obtained from this data source for Application Continuity protection:
oracle.jdbc.OracleConnection conn =
(oracle.jdbc.OracleConnection) ods.getConnection();
conn.beginRequest();
...... // JDBC calls protected by AC
conn.endRequest();
oracle.jdbc.datasource
,
oracle.jdbc.datasource.impl
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected static java.lang.String |
CHECKSUM_PROPERTY |
protected java.lang.String |
clientChecksum11203x |
protected java.lang.String |
clientChecksum12x |
protected java.util.Properties |
connectionProperties |
protected java.lang.String |
databaseName |
protected java.lang.String |
dataSourceName |
protected static java.lang.String |
DEFAULT_SERVICE_NAME |
protected java.lang.String |
description |
protected static java.lang.String |
DMS_DEFAULT_DATASOURCE_NAME |
protected static java.lang.String |
DMS_ROOT_NAME |
protected java.util.concurrent.atomic.AtomicBoolean |
doneDumpOnMemoryPressure |
protected oracle.jdbc.driver.OracleDriver |
driver |
protected java.lang.String |
driverType |
protected static java.lang.String |
ENABLE_AC_SUPPORT_PROPERTY |
protected static java.lang.String |
ENABLE_SSS_CURSOR_SUPPORT_PROPERTY |
protected boolean |
explicitCachingEnabled |
protected boolean |
explicitCachingEnabledSet |
protected static int |
FAILOVER_RESTORE_AUTO |
protected static int |
FAILOVER_RESTORE_LEVEL1 |
protected static int |
FAILOVER_RESTORE_LEVEL2 |
protected static int |
FAILOVER_RESTORE_NONE |
protected static java.lang.String |
FAILOVER_RESTORE_PROPERTY |
protected static int |
FAILOVER_TYPE_AUTO |
protected static int |
FAILOVER_TYPE_ON_REMOTE |
protected static java.lang.String |
FAILOVER_TYPE_PROPERTY |
protected static int |
FAILOVER_TYPE_TRANSACTION |
protected static java.lang.String |
IGNORE_AC_CONTEXT_PROPERTY |
protected boolean |
implicitCachingEnabled |
protected boolean |
implicitCachingEnabledSet |
protected static java.lang.String |
INITIATION_TIMEOUT_PROPERTY |
protected boolean |
isAutoACEnabled |
protected java.util.concurrent.atomic.AtomicBoolean |
isFirstConnection |
protected boolean |
isHybrid |
boolean |
isOracleDataSource |
protected boolean |
isReplayInDynamicMode |
protected boolean |
isSSSCursorEnabled |
protected boolean |
isStateRestorationAuto |
protected boolean |
isTransactionReplayEnabled |
protected int |
loginTimeout |
protected java.io.PrintWriter |
logWriter |
protected int |
maxStatements |
protected boolean |
maxStatementsSet |
protected java.lang.String |
networkProtocol |
protected oracle.jdbc.internal.OpaqueString |
password |
protected int |
portNumber |
protected static java.lang.String |
RECONNECT_DELAY_PROPERTY |
protected static java.lang.String |
RECONNECT_RETRIES_PROPERTY |
protected int |
reconnectDelay |
protected int |
reconnectRetries |
protected int |
replayInitiationTimeout |
protected static java.lang.String |
REQUEST_SIZE_LIMIT_PROPERTY |
protected java.lang.String |
serverName |
protected java.lang.String |
serviceName |
protected static int |
SESSION_STATE_CONSISTENCY_HYBRID |
protected static int |
SESSION_STATE_CONSISTENCY_STATIC |
protected static java.lang.String |
SESSION_STATE_PROPERTY |
protected oracle.jdbc.replay.internal.ReplayableConnection.StateRestorationType |
stateRestorationType |
protected java.lang.String |
tnsEntry |
static boolean |
TRACE |
protected java.util.concurrent.atomic.AtomicBoolean |
trackerInitialized |
protected static int |
unnamedInstanceCount |
protected java.lang.String |
url |
protected java.lang.String |
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 |
---|
OracleDataSource() |
Modifier and Type | Method and Description |
---|---|
protected void |
addRefProperties(javax.naming.Reference ref) |
static void |
cleanup() |
void |
clearDoneDumpOnMemoryPressure() |
void |
clearReplayStatistics()
Clears replay statistics accumulated so far on all connection
created by this data source.
|
OracleConnectionBuilderImpl |
createConnectionBuilder()
Creates a new instance
|
protected static java.lang.String |
dms_data_source_type() |
protected java.sql.Connection |
enableACAndProxifyIfNecessary(java.sql.Connection conn,
OracleConnectionBuilderImpl connBuilder) |
protected void |
finalize() |
java.sql.Connection |
getConnection()
Attempt to establish a database connection.
|
protected java.sql.Connection |
getConnection(OracleConnectionBuilderImpl builder)
Attempt to establish a database connection.
|
protected java.sql.Connection |
getConnection(java.lang.String _user,
oracle.jdbc.internal.OpaqueString _passwd)
Attempt to establish a database connection.
|
java.sql.Connection |
getConnection(java.lang.String user,
java.lang.String password)
Attempt to establish a database connection.
|
protected oracle.jdbc.internal.OracleConnection |
getConnectionDuringExceptionHandling() |
oracle.jdbc.replay.internal.ConnectionInitializationCallback |
getConnectionInitializationCallback()
Obtains the registered connection initialization callback, if any.
|
java.sql.Connection |
getConnectionNoProxy(OracleConnectionBuilderImpl connBuilder) |
java.util.Properties |
getConnectionProperties()
Gets the connection properties that are set on this data source object.
|
java.lang.String |
getConnectionProperty(java.lang.String propertyName)
Gets the specified connection property that is set on this data source.
|
java.lang.String |
getDatabaseName()
Get the name of the database set on this DataSource instance.
|
java.lang.String |
getDataSourceName()
Get the datasource name for this instance if set.
|
java.lang.String |
getDescription()
Get the Desciption of this data source.
|
Diagnosable |
getDiagnosable()
AC specifc
|
java.lang.String |
getDriverType()
Get the Oracle JDBC driver type set for this datasource instance
|
boolean |
getExplicitCachingEnabled()
getExplicitCachingEnabled
Returns the current value of the explicitCachingEnabled property.
|
boolean |
getImplicitCachingEnabled()
getImplicitCachingEnabled
Returns the current value of the implicitCachingEnabled property.
|
int |
getLoginTimeout()
Gets the maximum time in seconds that this data source can wait
while attempting to connect to a database.
|
java.io.PrintWriter |
getLogWriter()
Get the log writer for this data source.
|
int |
getMaxStatements()
getMaxStatements
Returns the current value of the maxStatements property.
|
oracle.jdbc.internal.Monitor.CloseableLock |
getMonitorLock() |
java.lang.String |
getNetworkProtocol()
Get the network protocol set.
|
java.util.logging.Logger |
getParentLogger() |
protected oracle.jdbc.internal.OpaqueString |
getPassword() |
protected java.sql.Connection |
getPhysicalConnection(java.util.Properties prop,
oracle.jdbc.internal.AbstractConnectionBuilder builder)
Get a connection to the database specified by this datasource.
|
int |
getPortNumber()
Get the port number on which server is listening for requests.
|
oracle.jdbc.proxy.ProxyFactory |
getProxyFactory() |
javax.naming.Reference |
getReference() |
ReplayStatistics |
getReplayStatistics()
Obtains replay statistics accumulated so far.
|
java.lang.String |
getReplayStatisticsString() |
int |
getRequestSizeLimit() |
java.lang.String |
getRoleName()
Gets the datasource role name.
|
java.lang.String |
getServerName()
Get the name of the server on which database is running.
|
java.lang.String |
getServiceName()
Get the service_name
To distinguish services from instances, a new URL
using service_name is added, existing url with
SID will be supported, but deprecated.
|
protected boolean |
getSSSCursorProperty() |
protected static java.lang.String |
getSystemProperty(java.lang.String property,
java.lang.String defaultValue) |
java.lang.String |
getTNSEntryName()
Get the TNS entry name for this instance if set.
|
java.lang.String |
getURL()
Get the URL for this datasource.
|
java.lang.String |
getUser()
Get the user name for this datasource.
|
boolean |
isWrapperFor(java.lang.Class<?> iface)
Since this class is not a wrapper, just check to see if this
implements the requested interface.
|
protected void |
makeURL() |
void |
registerConnectionInitializationCallback(oracle.jdbc.replay.internal.ConnectionInitializationCallback cbk)
Registers a ConnectionInitializationCallback with the data source.
|
static void |
registerMBean() |
void |
removeReplayStatistics(oracle.jdbc.replay.internal.ReplayStatistics stats) |
void |
setConnectionProperties(java.util.Properties properties)
Sets the Connection Properties for the datasource
|
void |
setConnectionProperty(java.lang.String name,
java.lang.String value)
Sets a connection property on the data source.
|
void |
setDatabaseName(java.lang.String dbname)
Set the name of a particular database on a server.
|
void |
setDataSourceName(java.lang.String dsname)
Set the DataSourceName.
|
void |
setDescription(java.lang.String des)
Set the Desciption for this data source instance.
|
void |
setDriverType(java.lang.String dt)
Set the JDBC driver type.
|
void |
setExplicitCachingEnabled(boolean cache)
setExplicitCachingEnabled
Sets the value of the explicitCachingEnabled property, which
enables or disables the explicit cache.
|
void |
setHostnameResolver(OracleHostnameResolver hostnameResolver)
Sets a custom hostname resolver implementing
OracleHostnameResolver
used to provide a custom DNS name resolution strategy to locate the database host. |
void |
setImplicitCachingEnabled(boolean cache)
setImplicitCachingEnabled
Sets the value of the implicitCachingEnabled property, which
enables or disables the implicit cache.
|
void |
setLoginTimeout(int timeout)
Sets the maximum time in seconds that this data source will wait
while attempting to connect to a database.
|
void |
setLogWriter(java.io.PrintWriter pw)
Set the log writer for this data source.
|
void |
setMaxStatements(int max)
Deprecated.
|
void |
setNetworkProtocol(java.lang.String np)
Set the network protocol for the connections.
|
void |
setPassword(java.lang.String pd)
Set the password with which connections have to be obtained.
|
void |
setPortNumber(int pn)
Set the port number where a server is listening for requests.
|
void |
setRoleName(java.lang.String roleName)
Sets the datasource role name.
|
void |
setServerName(java.lang.String sn)
Set the name of the Server on which database is running.
|
void |
setServiceName(java.lang.String svcname)
Set the service_name of a database on a server.
|
void |
setSingleShardTransactionSupport(boolean allow)
Sets single shard transaction support in auto commit OFF mode.
|
void |
setSSLContext(javax.net.ssl.SSLContext sslContext)
Specifies a
SSLContext to use as a factory for
SSLEngine objects that carry out the TLS
protocol. |
void |
setTNSEntryName(java.lang.String dbname)
Set the TNS entry name.
|
void |
setTokenSupplier(java.util.function.Supplier<? extends AccessToken> tokenSupplier)
Sets a supplier function that generates an access token when creating a
connection with this
DataSource . |
protected void |
setupACSpecificProperties(boolean useProxy) |
void |
setURL(java.lang.String url)
Set the URL from which connections have to be obtained.
|
void |
setUser(java.lang.String userName)
Set the user name with which connections have to be obtained.
|
void |
unregisterConnectionInitializationCallback(oracle.jdbc.replay.internal.ConnectionInitializationCallback cbk)
Removes the ConnectionInitializationCallback registered with the
data source, if any.
|
static void |
unregisterMBean() |
<T> T |
unwrap(java.lang.Class<T> iface)
Since this class is not a wrapper, just check to see if this
implements the requested interface.
|
void |
updateReplayStatistics(oracle.jdbc.replay.internal.ReplayStatistics newStats) |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
setExecutorService
createShardingKeyBuilder
protected static int unnamedInstanceCount
protected static final java.lang.String DMS_ROOT_NAME
protected static final java.lang.String DMS_DEFAULT_DATASOURCE_NAME
protected static final java.lang.String DEFAULT_SERVICE_NAME
protected java.io.PrintWriter logWriter
protected int loginTimeout
protected java.lang.String databaseName
protected java.lang.String serviceName
protected java.lang.String dataSourceName
protected java.lang.String description
protected java.lang.String networkProtocol
protected int portNumber
protected java.lang.String user
protected oracle.jdbc.internal.OpaqueString password
protected java.lang.String serverName
protected java.lang.String url
protected java.lang.String driverType
protected java.lang.String tnsEntry
protected int maxStatements
protected boolean implicitCachingEnabled
protected boolean explicitCachingEnabled
protected boolean maxStatementsSet
protected boolean implicitCachingEnabledSet
protected boolean explicitCachingEnabledSet
protected java.util.Properties connectionProperties
public boolean isOracleDataSource
protected transient oracle.jdbc.driver.OracleDriver driver
protected java.util.concurrent.atomic.AtomicBoolean isFirstConnection
protected static final java.lang.String RECONNECT_DELAY_PROPERTY
protected static final java.lang.String RECONNECT_RETRIES_PROPERTY
protected int reconnectDelay
protected int reconnectRetries
protected static final java.lang.String FAILOVER_TYPE_PROPERTY
protected static final int FAILOVER_TYPE_TRANSACTION
protected static final int SESSION_STATE_CONSISTENCY_STATIC
protected static final int FAILOVER_TYPE_AUTO
protected static final int SESSION_STATE_CONSISTENCY_HYBRID
protected static final int FAILOVER_TYPE_ON_REMOTE
protected boolean isTransactionReplayEnabled
protected boolean isAutoACEnabled
protected static final java.lang.String SESSION_STATE_PROPERTY
protected boolean isReplayInDynamicMode
protected boolean isHybrid
protected static final java.lang.String FAILOVER_RESTORE_PROPERTY
protected static final int FAILOVER_RESTORE_NONE
protected static final int FAILOVER_RESTORE_LEVEL1
protected static final int FAILOVER_RESTORE_LEVEL2
protected static final int FAILOVER_RESTORE_AUTO
protected oracle.jdbc.replay.internal.ReplayableConnection.StateRestorationType stateRestorationType
protected boolean isStateRestorationAuto
protected static final java.lang.String INITIATION_TIMEOUT_PROPERTY
protected int replayInitiationTimeout
protected static final java.lang.String CHECKSUM_PROPERTY
protected final java.lang.String clientChecksum12x
protected final java.lang.String clientChecksum11203x
protected static final java.lang.String IGNORE_AC_CONTEXT_PROPERTY
protected static final java.lang.String ENABLE_AC_SUPPORT_PROPERTY
protected static final java.lang.String REQUEST_SIZE_LIMIT_PROPERTY
protected static final java.lang.String ENABLE_SSS_CURSOR_SUPPORT_PROPERTY
protected boolean isSSSCursorEnabled
protected final java.util.concurrent.atomic.AtomicBoolean trackerInitialized
protected java.util.concurrent.atomic.AtomicBoolean doneDumpOnMemoryPressure
public static final boolean TRACE
public OracleDataSource() throws java.sql.SQLException
java.sql.SQLException
protected static java.lang.String dms_data_source_type()
public java.sql.Connection getConnection() throws java.sql.SQLException
Attempt to establish a database connection.
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
- if a database-access error occurs.public java.sql.Connection getConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
Attempt to establish a database connection.
getConnection
in interface javax.sql.DataSource
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 getConnection(java.lang.String _user, oracle.jdbc.internal.OpaqueString _passwd) throws java.sql.SQLException
Attempt to establish a database connection.
_user
- the database user on whose behalf the Connection is
being made_passwd
- the user's passwordjava.sql.SQLException
- if a database-access error occurs.protected java.sql.Connection getConnection(OracleConnectionBuilderImpl builder) throws java.sql.SQLException
Attempt to establish a database connection.
builder
- Builder which has the required properties set for building
the connectionjava.sql.SQLException
- if a database-access error occurs.protected java.sql.Connection getPhysicalConnection(java.util.Properties prop, oracle.jdbc.internal.AbstractConnectionBuilder builder) throws java.sql.SQLException
prop
- Connection properties specified on this datasource.builder
- The builder object used to create the connection.
May be null if a builder was not used to create the connection.java.sql.SQLException
public int getLoginTimeout()
getLoginTimeout
in interface javax.sql.CommonDataSource
java.sql.SQLException
- if a database access error occurs.public void setLoginTimeout(int timeout)
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise it specifies that there is no timeout. When a DataSource object is created the login timeout is initially zero.
setLoginTimeout
in interface javax.sql.CommonDataSource
seconds
- the data source login time limitjava.sql.SQLException
- if a database access error occurs.public void setLogWriter(java.io.PrintWriter pw)
Set the log writer for this data source.
The log writer is a character output stream to which all logging and tracing messages for this data source object instance will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. Messages printed to a data source specific log writer are not printed to the log writer associated with the java.sql.Drivermanager class. When a DataSource object is created the log writer is initially null, in other words, logging is disabled.
setLogWriter
in interface javax.sql.CommonDataSource
out
- the new log writer; to disable, set to nulljava.sql.SQLException
- if a database-access error occurs.public java.io.PrintWriter getLogWriter()
Get the log writer for this data source.
The log writer is a character output stream to which all logging and tracing messages for this data source object instance will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. Messages printed to a data source specific log writer are not printed to the log writer associated with the java.sql.Drivermanager class. When a DataSource object is created the log writer is initially null, in other words, logging is disabled.
getLogWriter
in interface javax.sql.CommonDataSource
java.sql.SQLException
- if a database-access error occurs.public void setTNSEntryName(java.lang.String dbname)
dbname
- tns entry namepublic java.lang.String getTNSEntryName()
public void setDataSourceName(java.lang.String dsname)
setDataSourceName
in interface OracleCommonDataSource
dsname
- DataSource Name to be set.public java.lang.String getDataSourceName()
getDataSourceName
in interface OracleCommonDataSource
public java.lang.String getDatabaseName()
getDatabaseName
in interface OracleCommonDataSource
public void setDatabaseName(java.lang.String dbname)
If URL is set, this property will be ignored.
setDatabaseName
in interface OracleCommonDataSource
dsname
- database name to be set.public void setServiceName(java.lang.String svcname)
svcname
- service_name to be set.public java.lang.String getServiceName()
public void setServerName(java.lang.String sn)
setServerName
in interface OracleCommonDataSource
sn
- server/host name to be set.public java.lang.String getServerName()
getServerName
in interface OracleCommonDataSource
public void setURL(java.lang.String url)
setURL
in interface OracleCommonDataSource
url
- URL to be set.public java.lang.String getURL() throws java.sql.SQLException
getURL
in interface OracleCommonDataSource
java.sql.SQLException
public void setUser(java.lang.String userName)
setUser
in interface OracleCommonDataSource
user
- Username to be set.public java.lang.String getUser()
getUser
in interface OracleCommonDataSource
public void setPassword(java.lang.String pd)
setPassword
in interface OracleCommonDataSource
pd
- Passowrd to be set.protected oracle.jdbc.internal.OpaqueString getPassword()
public java.lang.String getDescription()
getDescription
in interface OracleCommonDataSource
public void setDescription(java.lang.String des)
setDescription
in interface OracleCommonDataSource
des
- Desciption to be set.public java.lang.String getDriverType()
public void setDriverType(java.lang.String dt)
If set to kprb, nothing else is needed to open a connection. This is meant for Server side JDBC driver when running inside server.
If set to thin, serverName, portNumber and databaseName are need to open a connection.
If set to oci, and network protocol is set to IPC or TNSEntryName is set then nothing else is needed. If not, serverName, portNumber and databaseName have to be provided.
dt
- Driver Type tp be set.public java.lang.String getNetworkProtocol()
getNetworkProtocol
in interface OracleCommonDataSource
public void setNetworkProtocol(java.lang.String np) throws java.sql.SQLException
setNetworkProtocol
in interface OracleCommonDataSource
np
- set the network protocol to be used.java.sql.SQLException
public void setPortNumber(int pn)
setPortNumber
in interface OracleCommonDataSource
pn
- port number on which server is listeningpublic int getPortNumber()
getPortNumber
in interface OracleCommonDataSource
public javax.naming.Reference getReference() throws javax.naming.NamingException
getReference
in interface javax.naming.Referenceable
javax.naming.NamingException
protected void addRefProperties(javax.naming.Reference ref)
protected void makeURL() throws java.sql.SQLException
java.sql.SQLException
public void setMaxStatements(int max) throws java.sql.SQLException
setMaxStatements
in interface OracleCommonDataSource
max
- Requested size of the cache. If the existing cache size
is less than max, statements will be purged to reduce the
size.java.sql.SQLException
- if max < 0public int getMaxStatements() throws java.sql.SQLException
getMaxStatements
in interface OracleCommonDataSource
java.sql.SQLException
public void setImplicitCachingEnabled(boolean cache) throws java.sql.SQLException
setImplicitCachingEnabled
in interface OracleCommonDataSource
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.java.sql.SQLException
public boolean getImplicitCachingEnabled() throws java.sql.SQLException
getImplicitCachingEnabled
in interface OracleCommonDataSource
java.sql.SQLException
public void setExplicitCachingEnabled(boolean cache) throws java.sql.SQLException
setExplicitCachingEnabled
in interface OracleCommonDataSource
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.java.sql.SQLException
- if called on a logical connection.public boolean getExplicitCachingEnabled() throws java.sql.SQLException
getExplicitCachingEnabled
in interface OracleCommonDataSource
java.sql.SQLException
public void setConnectionProperties(java.util.Properties properties) throws java.sql.SQLException
The argument to this method is a Properties object. This properties object is used to create the connections returned by the receiver. The keys and values are Strings. The keys, values, and their meanings are defined in oracle.jdbc.OracleConnection.
setConnectionProperties
in interface OracleCommonDataSource
properties
- a Properties object with the desired connection property names
and values.java.sql.SQLException
OracleConnection
public void setRoleName(java.lang.String roleName) throws java.sql.SQLException
setRoleName
in interface OracleCommonDataSource
roleName
- datasource role name to be set.java.sql.SQLException
public java.lang.String getRoleName()
getRoleName
in interface OracleCommonDataSource
public java.util.Properties getConnectionProperties() throws java.sql.SQLException
getConnectionProperties
in interface OracleCommonDataSource
java.sql.SQLException
- If any exception occurs while getting the connection
properties.public java.lang.String getConnectionProperty(java.lang.String propertyName) throws java.sql.SQLException
getConnectionProperty
in interface OracleCommonDataSource
propertyName
- The name of the specified connection property.java.sql.SQLException
- If any exception occurs while getting the connection
property.public void setConnectionProperty(java.lang.String name, java.lang.String value) throws java.sql.SQLException
setConnectionProperty
in interface OracleCommonDataSource
name
- The name of the connection property to be set.value
- The value of the connection property to be set.java.sql.SQLException
- If any exception occurred while setting the connection
property.setConnectionProperties
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
iface
- requested interfacejava.sql.SQLException
- if the arg is not an interfacepublic <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
iface
- requested interfacejava.sql.SQLException
- if this does not implement the arg or
the arg is not an interfacepublic java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
getParentLogger
in interface javax.sql.CommonDataSource
java.sql.SQLFeatureNotSupportedException
public final void setSSLContext(javax.net.ssl.SSLContext sslContext)
OracleCommonDataSource
Specifies a SSLContext
to use as a factory for
SSLEngine objects that carry out the TLS
protocol.
The SSLContext must be initialized before establishing a connection with this data source. The certificates specified by that initialization will be used in place of any connection properties that would otherwise have specified certificates, such as key store and trust store property values.
Specifying a null value will clear any non-null SSLContext
previously set by this method
setSSLContext
in interface OracleCommonDataSource
sslContext
- An SSLContext to use as an SSLEngine factory. May be
null.public void setSingleShardTransactionSupport(boolean allow) throws java.sql.SQLException
OracleCommonDataSource
setSingleShardTransactionSupport
in interface OracleCommonDataSource
java.sql.SQLException
public void setHostnameResolver(OracleHostnameResolver hostnameResolver)
OracleCommonDataSource
OracleHostnameResolver
used to provide a custom DNS name resolution strategy to locate the database host.setHostnameResolver
in interface OracleCommonDataSource
hostnameResolver
- an OracleHostnameResolver to use when resolving the
datasource hostnameprotected oracle.jdbc.internal.OracleConnection getConnectionDuringExceptionHandling()
public OracleConnectionBuilderImpl createConnectionBuilder()
createConnectionBuilder
in interface OracleDataSource
public java.sql.Connection getConnectionNoProxy(OracleConnectionBuilderImpl connBuilder) throws java.sql.SQLException
java.sql.SQLException
protected void setupACSpecificProperties(boolean useProxy) throws java.sql.SQLException
java.sql.SQLException
protected java.sql.Connection enableACAndProxifyIfNecessary(java.sql.Connection conn, OracleConnectionBuilderImpl connBuilder) throws java.sql.SQLException
java.sql.SQLException
public void registerConnectionInitializationCallback(oracle.jdbc.replay.internal.ConnectionInitializationCallback cbk) throws java.sql.SQLException
cbk
- The ConnectionInitializationCallback to be registered.java.sql.SQLException
- If the argument is null or callback
registration fails.public void unregisterConnectionInitializationCallback(oracle.jdbc.replay.internal.ConnectionInitializationCallback cbk) throws java.sql.SQLException
cbk
- The ConnectionInitializationCallback
object to be unregistered.java.sql.SQLException
- If callback removal fails.public oracle.jdbc.replay.internal.ConnectionInitializationCallback getConnectionInitializationCallback()
OracleDataSource
ConnectionInitializationCallback
,
or null if there is no callback registered.public ReplayStatistics getReplayStatistics()
OracleDataSource
public void clearDoneDumpOnMemoryPressure()
public java.lang.String getReplayStatisticsString()
public void clearReplayStatistics()
OracleDataSource
public void updateReplayStatistics(oracle.jdbc.replay.internal.ReplayStatistics newStats)
public void removeReplayStatistics(oracle.jdbc.replay.internal.ReplayStatistics stats)
protected static java.lang.String getSystemProperty(java.lang.String property, java.lang.String defaultValue)
public int getRequestSizeLimit() throws java.sql.SQLException
java.sql.SQLException
protected final boolean getSSSCursorProperty() throws java.sql.SQLException
java.sql.SQLException
public oracle.jdbc.proxy.ProxyFactory getProxyFactory() throws java.sql.SQLException
java.sql.SQLException
public static void registerMBean()
public static void unregisterMBean()
public static void cleanup()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public Diagnosable getDiagnosable()
getDiagnosable
in interface Diagnosable
public final oracle.jdbc.internal.Monitor.CloseableLock getMonitorLock()
getMonitorLock
in interface oracle.jdbc.internal.Monitor
public final void setTokenSupplier(java.util.function.Supplier<? extends AccessToken> tokenSupplier)
OracleCommonDataSource
Sets a supplier function that generates an access token when creating a
connection with this DataSource
. The supplier function
is invoked each time this DataSource
creates a
connection. Instances of AccessToken
that are output by the
supplier must represent a token type that is supported by Oracle Database
for client authentication. The supplier must be thread safe.
It is invalid to configure this DataSource
with both a token
supplier and with a user name or password. If invocations of
OracleCommonDataSource.setUser(String)
, OracleCommonDataSource.setPassword(String)
,
OracleCommonDataSource.setConnectionProperties(java.util.Properties)
, or
OracleCommonDataSource.setConnectionProperty(String, String)
have configured this
DataSource
with a user name or password, and an invocation of
this method has also configured a token supplier, then a
SQLException
indicating an invalid configuration is thrown when
creating a connection with this datasource.
Note that AccessToken.createJsonWebTokenCache(Supplier)
can be
called to create a thread safe Supplier
that caches tokens from
a user defined Supplier
.
setTokenSupplier
in interface OracleCommonDataSource
tokenSupplier
- Token supplying function. Not null
.