Class PoolDataSourceImpl
- java.lang.Object
-
- oracle.ucp.jdbc.PoolDataSourceImpl
-
- All Implemented Interfaces:
java.io.Serializable
,java.sql.Wrapper
,javax.naming.Referenceable
,javax.naming.spi.ObjectFactory
,javax.sql.CommonDataSource
,javax.sql.DataSource
,PoolDataSource
,UniversalConnectionPoolAdapter
- Direct Known Subclasses:
PoolXADataSourceImpl
public class PoolDataSourceImpl extends java.lang.Object implements PoolDataSource, java.io.Serializable, javax.naming.Referenceable, javax.naming.spi.ObjectFactory, UniversalConnectionPoolAdapter
A connection pool-aware data source. This DataSource uses the Universal Connection Pool to get a connection, creating a proxy to that connection, and returning the proxy to the client. When the client calls close on the connection proxy, the underlying physical connection is returned to the pool.Besides other data source properties, applications must set the connection factory class name. The connection factory class is a class that implements javax.sql.DataSource and does not implement its own connection pooling. The connection factory's getConnection(...) methods should return a physical JDBC connection to the database. For example, "oracle.jdbc.pool.OracleDataSource" is a valid connection factory class name.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface oracle.ucp.jdbc.PoolDataSource
PoolDataSource.HostnameResolver
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SECRET_STORE_CONNECT
static java.lang.String
SECRET_STORE_DEFAULT_PASSWORD
static java.lang.String
SECRET_STORE_DEFAULT_USERNAME
static java.lang.String
SECRET_STORE_PASSWORD
static java.lang.String
SECRET_STORE_USERNAME
-
Fields inherited from interface oracle.ucp.jdbc.PoolDataSource
UCP_ABANDONED_CONNECTION_TIMEOUT, UCP_CONNECTION_AFFINITY_CALLBACK, UCP_CONNECTION_FACTORY_CLASS_NAME, UCP_CONNECTION_FACTORY_PROPERTIES, UCP_CONNECTION_HARVEST_MAX_COUNT, UCP_CONNECTION_HARVEST_TRIGGER_COUNT, UCP_CONNECTION_INITIALIZATION_CALLBACK, UCP_CONNECTION_LABELING_CALLBACK, UCP_CONNECTION_LABELING_HIGH_COST, UCP_CONNECTION_POOL_NAME, UCP_CONNECTION_PROPERTIES, UCP_CONNECTION_REPURPOSE_THRESHOLD, UCP_CONNECTION_VALIDATION_TIMEOUT, UCP_CONNECTION_WAIT_TIMEOUT, UCP_DATA_SOURCE_FROM_CONFIGURATION, UCP_DATA_SOURCE_NAME, UCP_DATABASE_NAME, UCP_DESCRIPTION, UCP_FAST_CONNECTION_FAILOVER_ENABLED, UCP_HIGH_COST_CONNECTION_REUSE_THRESHOLD, UCP_INACTIVE_CONNECTION_TIMEOUT, UCP_INITIAL_POOL_SIZE, UCP_LOGIN_TIMEOUT, UCP_MAX_CONNECTION_REUSE_COUNT, UCP_MAX_CONNECTION_REUSE_TIME, UCP_MAX_CONNECTIONS_PER_SERVICE, UCP_MAX_CONNECTIONS_PER_SHARD, UCP_MAX_IDLE_TIME, UCP_MAX_POOL_SIZE, UCP_MAX_STATEMENTS, UCP_MIN_POOL_SIZE, UCP_NETWORK_PROTOCOL, UCP_NTH_RETURNED_CONNECTION_TO_VALIDATE, UCP_ONS_CONFIGURATION, UCP_PASSWORD, UCP_PDB_ROLES, UCP_PORT_NUMBER, UCP_PROPERTY_CYCLE, UCP_READONLY_INSTANCE_ALLOWED, UCP_ROLE_NAME, UCP_SECONDS_TO_TRUST_IDLE_CONNECTION, UCP_SERVER_NAME, UCP_SERVICE_NAME, UCP_SHARDING_MODE, UCP_SQL_FOR_VALIDATE_CONNECTION, UCP_TIME_TO_LIVE_CONNECTION_TIMEOUT, UCP_TIMEOUT_CHECK_INTERVAL, UCP_URL, UCP_USER, UCP_VALIDATE_CONNECTION_ON_BORROW
-
-
Constructor Summary
Constructors Constructor Description PoolDataSourceImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description UCPConnectionBuilder
createConnectionBuilder()
Creates a new UCPConnectionBuilder instance.protected void
createPoolWithDefaultProperties()
UniversalConnectionPool
createUniversalConnectionPool()
Creates a Universal Connection Pool instance using this adapter.UniversalConnectionPoolMBean
createUniversalConnectionPoolMBean()
Creates a Universal Connection Pool MBean using this adapter.int
getAbandonedConnectionTimeout()
Gets the abandoned connection timeout value.int
getAvailableConnectionsCount()
Gets the number of available connections in the pool.int
getBorrowedConnectionsCount()
Gets the number of borrowed connections from the pool.java.sql.Connection
getConnection()
Attempts to obtain a database connection.java.sql.Connection
getConnection(java.lang.String username, java.lang.String password)
Attempts to obtain a database connection.java.sql.Connection
getConnection(java.lang.String username, java.lang.String password, java.util.Properties labels)
Attempts to obtain a database connection with the requested connection labels.java.sql.Connection
getConnection(java.util.Properties labels)
Attempts to obtain a database connection with the requested connection labels.java.lang.String
getConnectionFactoryClassName()
Gets the Connection Factory class name.java.util.Properties
getConnectionFactoryProperties()
Gets the connection factory properties that are set on this data source.java.lang.String
getConnectionFactoryProperty(java.lang.String propertyName)
Gets the specified connection factory property that are set on this data source.int
getConnectionHarvestMaxCount()
Gets the maximum number of connections that may be harvested when the connection harvesting occurs.int
getConnectionHarvestTriggerCount()
Gets the number of available connections at which the connection pool's connection harvesting will occur.ConnectionInitializationCallback
getConnectionInitializationCallback()
Obtains the registered connection initialization callback, if any.int
getConnectionLabelingHighCost()
Obtains the cost value which identifies a connection as "high-cost" for connection labeling.java.lang.String
getConnectionPoolName()
Gets the connection pool name.java.util.Properties
getConnectionProperties()
Gets the connection properties that are set on this data source.java.lang.String
getConnectionProperty(java.lang.String propertyName)
Gets the specified connection property that are set on this data source.int
getConnectionRepurposeThreshold()
Gets the connection repurpose threshold for the pool.int
getConnectionValidationTimeout()
Connection validation timeout getterint
getConnectionWaitTimeout()
Gets the amount of time to wait (in seconds) for a used connection to be released by a client.java.lang.String
getDatabaseName()
Gets the database name.java.lang.String
getDataSourceName()
Gets the data source name.java.lang.String
getDescription()
Gets the data source description.boolean
getFastConnectionFailoverEnabled()
Checks if Fast Connection Failover is enabled.int
getHighCostConnectionReuseThreshold()
Obtains the high-cost connection reuse threshold property value for connection labeling.protected PoolDataSource.HostnameResolver
getHostnameResolver()
Returns the hostname resolver associated with this datasourceint
getInactiveConnectionTimeout()
Gets the inactive connection timeout.int
getInitialPoolSize()
Gets the initial pool size.int
getLoginTimeout()
Gets the default maximum time in seconds that a driver will wait while attempting to connect to a database once the driver has been identified.java.io.PrintWriter
getLogWriter()
int
getMaxConnectionReuseCount()
Gets the connection reuse count property.long
getMaxConnectionReuseTime()
Gets the connection reuse time property.int
getMaxConnectionsPerService()
Gets the maximum number of connections that can be obtained to a particular service, in a shared pool.int
getMaxConnectionsPerShard()
Gets the currently configured max connections that can be created per shard in a sharded database configuration.int
getMaxIdleTime()
Gets Idle timeout value.int
getMaxPoolSize()
Gets the maximum number of connections that the connection pool will maintain.int
getMaxStatements()
Gets the maximum number of statements that may be pooled or cached on a Connection.int
getMinPoolSize()
Gets the minimum number of connections that the connection pool will maintain.java.lang.String
getNetworkProtocol()
Gets the datasource networkProtocol.java.lang.Object
getObjectInstance(java.lang.Object refObj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable<?,?> env)
java.lang.String
getONSConfiguration()
Returns the ONS configuration string that is used for remote ONS subscription, in the form specified in setONSConfiguration(String).java.util.logging.Logger
getParentLogger()
java.util.Properties
getPdbRoles()
Gets the PDB roles specified for this datasourceint
getPortNumber()
Gets the database port number.int
getPropertyCycle()
Gets Property cycle in seconds.int
getQueryTimeout()
Gets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds.javax.naming.Reference
getReference()
java.lang.String
getRoleName()
Gets the datasource role name.int
getSecondsToTrustIdleConnection()
Gets the seconds To Trust Idle Connection value.java.lang.String
getServerName()
Gets the database server name.java.lang.String
getServiceName()
Gets the service name set on this data sourceboolean
getShardingMode()
Returns the mode of UCP when UCP is using a Sharded Database.java.lang.String
getSQLForValidateConnection()
Gets the Value for SQLForValidateConnection property.protected javax.net.ssl.SSLContext
getSSLContext()
Returns SSL context associated with the datasource.JDBCConnectionPoolStatistics
getStatistics()
Gets the statistics of the connection pool.int
getTimeoutCheckInterval()
Gets the timeout check interval (in seconds).int
getTimeToLiveConnectionTimeout()
Gets the maximum time (in seconds) a connection may remain in-use.java.lang.String
getURL()
Gets the URL for this data source.java.lang.String
getUser()
Gets the user name for this data source.boolean
getValidateConnectionOnBorrow()
Returns whether or not a connection being borrowed should first be validated.protected void
ilogFine(java.util.logging.Logger logger, java.lang.Class<?> cls, java.lang.reflect.Executable method, java.lang.Object receiver, java.lang.String message)
protected void
ilogFinest(java.util.logging.Logger logger, java.lang.Class<?> cls, java.lang.reflect.Executable method, java.lang.Object receiver, java.lang.String message)
Helpers for writing into log and logWriterprotected void
ilogSevere(java.util.logging.Logger logger, java.lang.Class<?> cls, java.lang.reflect.Executable method, java.lang.Object receiver, java.lang.String message)
protected void
ilogThrowing(java.util.logging.Logger logger, java.lang.Class<?> cls, java.lang.reflect.Executable method, java.lang.Object receiver, java.lang.Throwable throwable)
protected void
ilogWarning(java.util.logging.Logger logger, java.lang.Class<?> cls, java.lang.reflect.Executable method, java.lang.Object receiver, java.lang.String message)
boolean
isReadOnlyInstanceAllowed()
Returns true if the connection borrow is allowed to a read-only instance, false otherwise.static boolean
isSetOnceProperty(java.lang.String key)
Authentication kays to enforce to be set up once per a single pool data sourceboolean
isWrapperFor(java.lang.Class<?> iface)
Since this class is not a wrapper, just check to see if this implements the requested interface.void
reconfigureDataSource(java.util.Properties configuration)
Reconfigures the data source.void
registerConnectionAffinityCallback(ConnectionAffinityCallback cbk)
Registers a ConnectionAffinityCallback on the connection pool.void
registerConnectionInitializationCallback(ConnectionInitializationCallback cbk)
Registers a connection initialization callback.void
registerConnectionLabelingCallback(ConnectionLabelingCallback cbk)
Registers a ConnectionLabelingCallback with the underlying connection pool.void
removeConnectionAffinityCallback()
Removes the ConnectionAffinityCallback registered on the connection pool.void
removeConnectionLabelingCallback()
Removes the ConnectionLabelingCallback object registered with the underlying connection pool, if any.void
setAbandonedConnectionTimeout(int abandonedConnectionTimeout)
Sets the abandoned connection timeout.void
setConnectionFactoryClassName(java.lang.String factoryClassName)
Sets the Connection Factory class name.void
setConnectionFactoryProperties(java.util.Properties factoryProperties)
Sets the connection factory properties on the connection factory.void
setConnectionFactoryProperty(java.lang.String name, java.lang.String value)
Sets a connection factory property on the connection factory.void
setConnectionHarvestMaxCount(int connectionHarvestMaxCount)
Sets the maximum number of connections that may be harvested when the connection harvesting occurs.void
setConnectionHarvestTriggerCount(int connectionHarvestTriggerCount)
Sets the number of available connections at which the connection pool's connection harvesting will occur.void
setConnectionLabelingHighCost(int highCost)
Sets the cost value which identifies a connection as "high-cost" for connection labeling.void
setConnectionPoolName(java.lang.String connectionPoolName)
Sets the connection pool name.void
setConnectionProperties(java.util.Properties connectionProperties)
Sets the connection properties on the connection factory.void
setConnectionProperty(java.lang.String name, java.lang.String value)
Sets a connection property on the connection factory.void
setConnectionRepurposeThreshold(int threshold)
Sets the connection repurpose threshold for the pool.void
setConnectionValidationTimeout(int connectionValidationTimeout)
This property changes the connection validation timeout which is specified in seconds.void
setConnectionWaitTimeout(int waitTimeout)
Sets the amount of time to wait (in seconds) for a used connection to be released by a client.void
setDatabaseName(java.lang.String databaseName)
Sets the database name.void
setDataSourceName(java.lang.String dataSourceName)
Sets the data source name.void
setDescription(java.lang.String dataSourceDescription)
Sets the data source description.void
setFastConnectionFailoverEnabled(boolean failoverEnabled)
Enables Fast Connection Failover (FCF) for the connection pool accessed using this pool-enabled data source.void
setHighCostConnectionReuseThreshold(int threshold)
Sets the high-cost connection reuse threshold for connection labeling.void
setHostnameResolver(PoolDataSource.HostnameResolver hostnameResolver)
Specifies aPoolDataSource#HostnameResolver
to use by the poolvoid
setInactiveConnectionTimeout(int inactivityTimeout)
Sets the inactive connection timeout.void
setInitialPoolSize(int initialPoolSize)
Sets the initial pool size.void
setLoginTimeout(int seconds)
Sets the default maximum time in seconds that a driver will wait while attempting to connect to a database once the driver has been identified.void
setLogWriter(java.io.PrintWriter logWriter)
void
setMaxConnectionReuseCount(int maxConnectionReuseCount)
Gets the connection reuse count property.void
setMaxConnectionReuseTime(long maxConnectionReuseTime)
Gets the connection reuse time property.void
setMaxConnectionsPerShard(int maxConnectionsPerShard)
Sets the max number of connections that can be created per shard in a sharded database configuration.void
setMaxIdleTime(int idleTime)
Sets Idle timeout for available connections in the pool.void
setMaxPoolSize(int maxPoolSize)
Sets the maximum number of connections.void
setMaxStatements(int maxStatements)
Sets the maximum number of statements that may be pooled or cached on a connection.void
setMinPoolSize(int minPoolSize)
Sets the minimum number of connections.void
setNetworkProtocol(java.lang.String networkProtocol)
Sets the datasource networkProtocol.void
setONSConfiguration(java.lang.String onsConfigStr)
Sets the configuration string used for remote ONS subscription.void
setPassword(java.lang.String password)
Sets the password with which connections have to be obtained.void
setPortNumber(int portNumber)
Sets the database port number.void
setPropertyCycle(int propertyCycle)
Sets Property cycle in seconds.void
setQueryTimeout(int queryTimeout)
Sets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds.void
setReadOnlyInstanceAllowed(boolean readOnlyInstanceAllowed)
Sets the read-only instance allowed value on the datasource.void
setRoleName(java.lang.String roleName)
Sets the datasource role name.void
setSecondsToTrustIdleConnection(int secondsToTrustIdleConnection)
Sets the time in seconds to trust an idle connection to skip a validation test.void
setServerName(java.lang.String serverName)
Sets the database server name.void
setShardingMode(boolean shardingMode)
This API changes the mode of UCP when UCP is using a Sharded Database.void
setSQLForValidateConnection(java.lang.String SQLString)
Sets the value(SQL) for SQLForValidateConnection property.void
setSSLContext(javax.net.ssl.SSLContext sslContext)
Specifies aSSLContext
to use as a factory for SSLEngine objects that carry out the TLS protocol.void
setTimeoutCheckInterval(int timeInterval)
Sets the timeoutCheckInterval (in seconds).void
setTimeToLiveConnectionTimeout(int timeToLiveConnectionTimeout)
Sets the maximum time (in seconds) a connection may remain in-use.void
setTokenSupplier(java.util.function.Supplier<? extends oracle.jdbc.AccessToken> tokenSupplier)
Sets a supplier function that generates an access token when creating a connection with thisDataSource
.void
setURL(java.lang.String url)
Sets the URL that the data source uses to obtain connections to the database.void
setUser(java.lang.String username)
Sets the user name with which connections have to be obtained.void
setValidateConnectionOnBorrow(boolean validateConnectionOnBorrow)
Sets whether or not a connection being borrowed should first be validated.void
startPool()
Helper to start pool without keeping metadata connection if initPoolSize is 0.protected void
startPool(boolean keepMetadataConn)
This helper method gets all the pool properties for pool initialization, creates a pool and starts it.static java.lang.Object
toBasicType(java.lang.String value, java.lang.String type)
void
unregisterConnectionInitializationCallback()
Unregisters the connection initialization callback on this pool.<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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface oracle.ucp.jdbc.PoolDataSource
createShardingKeyBuilder, getPassword
-
-
-
-
Field Detail
-
SECRET_STORE_CONNECT
public static final java.lang.String SECRET_STORE_CONNECT
- See Also:
- Constant Field Values
-
SECRET_STORE_USERNAME
public static final java.lang.String SECRET_STORE_USERNAME
- See Also:
- Constant Field Values
-
SECRET_STORE_PASSWORD
public static final java.lang.String SECRET_STORE_PASSWORD
- See Also:
- Constant Field Values
-
SECRET_STORE_DEFAULT_USERNAME
public static final java.lang.String SECRET_STORE_DEFAULT_USERNAME
- See Also:
- Constant Field Values
-
SECRET_STORE_DEFAULT_PASSWORD
public static final java.lang.String SECRET_STORE_DEFAULT_PASSWORD
- See Also:
- Constant Field Values
-
-
Method Detail
-
startPool
public void startPool() throws java.sql.SQLException
Helper to start pool without keeping metadata connection if initPoolSize is 0.- Throws:
java.sql.SQLException
-
startPool
protected void startPool(boolean keepMetadataConn) throws java.sql.SQLException
This helper method gets all the pool properties for pool initialization, creates a pool and starts it.- Parameters:
keepMetadataConn
- keep metadata connection in the working set even if init pool size is 0 (because the next operation will be "borrow").- Throws:
java.sql.SQLException
- if a database-access error occurs.
-
createPoolWithDefaultProperties
protected void createPoolWithDefaultProperties() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
createUniversalConnectionPool
public UniversalConnectionPool createUniversalConnectionPool() throws java.sql.SQLException
Creates a Universal Connection Pool instance using this adapter. Pool and connection factory configuration properties should be set on this adapter prior to invoking this method.This method should not register the created pool instance with the Universal Connection Pool Manager. The method createConnectionPool on the UniversalConnectionPoolManager is responsible for that.
This method is intended to be used in association with a UniversalConnectionPoolManager or MBean. Do not directly invoke this method from an instance of this class.
- Specified by:
createUniversalConnectionPool
in interfaceUniversalConnectionPoolAdapter
- Returns:
- The created Universal Connection Pool instance.
- Throws:
java.sql.SQLException
- If any error occurs during the process of connection pool creation.- See Also:
UniversalConnectionPoolManager
-
reconfigureDataSource
public void reconfigureDataSource(java.util.Properties configuration) throws java.sql.SQLException
Reconfigures the data source. This API can be only used to modify existing data source properties. To add a new data source to a running pool instance, use PoolDataSourceFactory's getPoolDataSource(Properties configuration) API instead. Only the following data source properties can be modified using this API:user
,password
,description
,serviceName
,pdbRoles
.- Specified by:
reconfigureDataSource
in interfacePoolDataSource
- Parameters:
configuration
- the configuration input- Throws:
java.sql.SQLException
- If an error occurs while configuring the data source.
-
createUniversalConnectionPoolMBean
public UniversalConnectionPoolMBean createUniversalConnectionPoolMBean() throws java.sql.SQLException
Creates a Universal Connection Pool MBean using this adapter. If a Universal Connection Pool instance is not yet created, this method must first create a pool instance, in which case pool and connection factory configuration properties should be set on this adapter prior to invoking this method.This method should not register the created pool MBean with the MBean server. The operation createConnectionPool on the UniversalConnectionPoolManagerMBean is responsible for that.
- Specified by:
createUniversalConnectionPoolMBean
in interfaceUniversalConnectionPoolAdapter
- Returns:
- The created Universal Connection Pool MBean.
- Throws:
java.sql.SQLException
- If any error occurs during the process of connection pool creation.- See Also:
UniversalConnectionPoolManagerMBean
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
Attempts to obtain a database connection.- Specified by:
getConnection
in interfacejavax.sql.DataSource
- Returns:
- A Connection to the database.
- Throws:
java.sql.SQLException
- if a database-access error occurs.
-
getConnection
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
Attempts to obtain a database connection.- Specified by:
getConnection
in interfacejavax.sql.DataSource
- Parameters:
username
- The database user on whose behalf the connection is being made.password
- The user's password.- Returns:
- A Connection to the database.
- Throws:
java.sql.SQLException
- if a database-access error occurs.
-
getConnection
public java.sql.Connection getConnection(java.util.Properties labels) throws java.sql.SQLException
Attempts to obtain a database connection with the requested connection labels.- Specified by:
getConnection
in interfacePoolDataSource
- Parameters:
labels
- The requested connection labels.- Returns:
- A Connection to the database.
- Throws:
java.sql.SQLException
- if a database-access error occurs.
-
getConnection
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password, java.util.Properties labels) throws java.sql.SQLException
Attempts to obtain a database connection with the requested connection labels.- Specified by:
getConnection
in interfacePoolDataSource
- Parameters:
username
- The database user on whose behalf the connection is being made.password
- The user's password.labels
- The requested connection labels.- Returns:
- A Connection to the database.
- Throws:
java.sql.SQLException
- if a database-access error occurs.
-
getLogWriter
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
- Specified by:
getLogWriter
in interfacejavax.sql.CommonDataSource
- Specified by:
getLogWriter
in interfacejavax.sql.DataSource
- Throws:
java.sql.SQLException
-
setLogWriter
public void setLogWriter(java.io.PrintWriter logWriter) throws java.sql.SQLException
- Specified by:
setLogWriter
in interfacejavax.sql.CommonDataSource
- Specified by:
setLogWriter
in interfacejavax.sql.DataSource
- Throws:
java.sql.SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws java.sql.SQLException
Sets the default maximum time in seconds that a driver will wait while attempting to connect to a database once the driver has been identified.- Specified by:
setLoginTimeout
in interfacejavax.sql.CommonDataSource
- Specified by:
setLoginTimeout
in interfacejavax.sql.DataSource
- Parameters:
seconds
- timeout- Throws:
java.sql.SQLException
- in case of negative value
-
getLoginTimeout
public int getLoginTimeout()
Gets the default maximum time in seconds that a driver will wait while attempting to connect to a database once the driver has been identified.- Specified by:
getLoginTimeout
in interfacejavax.sql.CommonDataSource
- Specified by:
getLoginTimeout
in interfacejavax.sql.DataSource
- Returns:
- timeout in seconds
-
getUser
public java.lang.String getUser()
Description copied from interface:PoolDataSource
Gets the user name for this data source.- Specified by:
getUser
in interfacePoolDataSource
- Returns:
- userName for this data source.
-
setUser
public void setUser(java.lang.String username) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the user name with which connections have to be obtained.- Specified by:
setUser
in interfacePoolDataSource
- Parameters:
username
- Username to be set.- Throws:
java.sql.SQLException
- in case of inability to set user.
-
setPassword
public void setPassword(java.lang.String password) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the password with which connections have to be obtained.- Specified by:
setPassword
in interfacePoolDataSource
- Parameters:
password
- Password to be set.- Throws:
java.sql.SQLException
- in case of inability to set password.
-
getURL
public java.lang.String getURL()
Description copied from interface:PoolDataSource
Gets the URL for this data source.- Specified by:
getURL
in interfacePoolDataSource
- Returns:
- URL for this data source.
-
setURL
public void setURL(java.lang.String url) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the URL that the data source uses to obtain connections to the database.- Specified by:
setURL
in interfacePoolDataSource
- Parameters:
url
- URL to be set.- Throws:
java.sql.SQLException
- in case of inability to set URL.
-
setServerName
public void setServerName(java.lang.String serverName) throws java.sql.SQLException
Sets the database server name.- Specified by:
setServerName
in interfacePoolDataSource
- Parameters:
serverName
- Database server name to be set.- Throws:
java.sql.SQLException
- in case of inability to set server name.
-
getServerName
public java.lang.String getServerName()
Gets the database server name.- Specified by:
getServerName
in interfacePoolDataSource
- Returns:
- Database server name.
-
setPortNumber
public void setPortNumber(int portNumber) throws java.sql.SQLException
Sets the database port number.- Specified by:
setPortNumber
in interfacePoolDataSource
- Parameters:
portNumber
- Database port number to be set.- Throws:
java.sql.SQLException
- in case of inability to set port number.
-
getPortNumber
public int getPortNumber()
Gets the database port number.- Specified by:
getPortNumber
in interfacePoolDataSource
- Returns:
- Database port number.
-
setDatabaseName
public void setDatabaseName(java.lang.String databaseName) throws java.sql.SQLException
Sets the database name.- Specified by:
setDatabaseName
in interfacePoolDataSource
- Parameters:
databaseName
- Database name to be set.- Throws:
java.sql.SQLException
- in case of inability to set db name.
-
getDatabaseName
public java.lang.String getDatabaseName()
Gets the database name.- Specified by:
getDatabaseName
in interfacePoolDataSource
- Returns:
- Database name.
-
setDataSourceName
public void setDataSourceName(java.lang.String dataSourceName) throws java.sql.SQLException
Sets the data source name.- Specified by:
setDataSourceName
in interfacePoolDataSource
- Parameters:
dataSourceName
- data source name to be set.- Throws:
java.sql.SQLException
- in case of inability to set datasource name.
-
getDataSourceName
public java.lang.String getDataSourceName()
Gets the data source name.- Specified by:
getDataSourceName
in interfacePoolDataSource
- Returns:
- data source name.
-
setDescription
public void setDescription(java.lang.String dataSourceDescription) throws java.sql.SQLException
Sets the data source description.- Specified by:
setDescription
in interfacePoolDataSource
- Parameters:
description
- data source description to be set.- Throws:
java.sql.SQLException
- in case of inability to set description.
-
getDescription
public java.lang.String getDescription()
Gets the data source description.- Specified by:
getDescription
in interfacePoolDataSource
- Returns:
- data source description.
-
setNetworkProtocol
public void setNetworkProtocol(java.lang.String networkProtocol) throws java.sql.SQLException
Sets the datasource networkProtocol.- Specified by:
setNetworkProtocol
in interfacePoolDataSource
- Parameters:
networkProtocol
- datasource networkProtocol to be set.- Throws:
java.sql.SQLException
- in case of inability to set protocol.
-
getNetworkProtocol
public java.lang.String getNetworkProtocol()
Gets the datasource networkProtocol.- Specified by:
getNetworkProtocol
in interfacePoolDataSource
- Returns:
- datasource networkProtocol.
-
setRoleName
public void setRoleName(java.lang.String roleName) throws java.sql.SQLException
Sets the datasource role name.- Specified by:
setRoleName
in interfacePoolDataSource
- Parameters:
roleName
- datasource role name to be set.- Throws:
java.sql.SQLException
- in case of inability to set role name.
-
getRoleName
public java.lang.String getRoleName()
Gets the datasource role name.- Specified by:
getRoleName
in interfacePoolDataSource
- Returns:
- datasource role name.
-
setInitialPoolSize
public void setInitialPoolSize(int initialPoolSize) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the initial pool size. This is the number of connections that will be created and placed in the pool when the pool is started.The range of valid values is 0 to
Integer.MAX_VALUE
. It is illegal to set this to a value greater than the maximum pool size. Defaults to 0.- Specified by:
setInitialPoolSize
in interfacePoolDataSource
- Parameters:
initialPoolSize
- the initial pool size.- Throws:
java.sql.SQLException
- in case of inability to set size.
-
getInitialPoolSize
public int getInitialPoolSize()
Description copied from interface:PoolDataSource
Gets the initial pool size.- Specified by:
getInitialPoolSize
in interfacePoolDataSource
- Returns:
- the initial pool size.
-
setMinPoolSize
public void setMinPoolSize(int minPoolSize) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the minimum number of connections. If the number of available connections PLUS the number of connections in use IS LESS THAN the minimum then the connection is returned to the pool. Otherwise, the connection is closed.The range of valid values is 0 to
Integer.MAX_VALUE
. It is illegal to set this to a value greater than the maximum pool size. Defaults to 0.- Specified by:
setMinPoolSize
in interfacePoolDataSource
- Parameters:
minPoolSize
- The minimum number of connections.- Throws:
java.sql.SQLException
- in case of inability to set min pool size.
-
getMinPoolSize
public int getMinPoolSize()
Description copied from interface:PoolDataSource
Gets the minimum number of connections that the connection pool will maintain.- Specified by:
getMinPoolSize
in interfacePoolDataSource
- Returns:
- The minimum number of connections.
-
setMaxPoolSize
public void setMaxPoolSize(int maxPoolSize) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the maximum number of connections. The maximum number of connections includes the number of connections that are in use as well as the number of available connections.The range of valid values is 1 to
Integer.MAX_VALUE
. Defaults toInteger.MAX_VALUE
.- Specified by:
setMaxPoolSize
in interfacePoolDataSource
- Parameters:
maxPoolSize
- The maximum number of connections.- Throws:
java.sql.SQLException
- in case of inability to set max pool size.
-
getMaxPoolSize
public int getMaxPoolSize()
Description copied from interface:PoolDataSource
Gets the maximum number of connections that the connection pool will maintain.- Specified by:
getMaxPoolSize
in interfacePoolDataSource
- Returns:
- The maximum number of connections.
-
getMaxConnectionsPerService
public int getMaxConnectionsPerService()
Description copied from interface:PoolDataSource
Gets the maximum number of connections that can be obtained to a particular service, in a shared pool.- Specified by:
getMaxConnectionsPerService
in interfacePoolDataSource
- Returns:
- The maximum number of connections that can be obtained to a particular service.
-
setInactiveConnectionTimeout
public void setInactiveConnectionTimeout(int inactivityTimeout) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the inactive connection timeout. This timeout determines how long an available connection remains in the connection pool before it is removed from the pool.The range of valid values is 0 to
Integer.MAX_VALUE
. Defaults to 0.Setting the value to 0 disables inactive connection timeout processing.
- Specified by:
setInactiveConnectionTimeout
in interfacePoolDataSource
- Parameters:
inactivityTimeout
- The inactive connection timeout in seconds.- Throws:
java.sql.SQLException
- in case of inability to set timeout.
-
getInactiveConnectionTimeout
public int getInactiveConnectionTimeout()
Description copied from interface:PoolDataSource
Gets the inactive connection timeout.- Specified by:
getInactiveConnectionTimeout
in interfacePoolDataSource
- Returns:
- The inactivity timeout.
-
setConnectionWaitTimeout
public void setConnectionWaitTimeout(int waitTimeout) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the amount of time to wait (in seconds) for a used connection to be released by a client.The range of valid values is 0 to
Integer.MAX_VALUE
. Defaults to 3.Setting the value to 0 disables connection wait timeout processing.
- Specified by:
setConnectionWaitTimeout
in interfacePoolDataSource
- Parameters:
waitTimeout
- The amount of time to wait.- Throws:
java.sql.SQLException
- in case of inability to set timeout.
-
getConnectionWaitTimeout
public int getConnectionWaitTimeout()
Description copied from interface:PoolDataSource
Gets the amount of time to wait (in seconds) for a used connection to be released by a client. This only applies when the maximum number of connections has been borrowed from the connection pool. When a client tries to borrow a connection from the pool and all connections are in use, the connection pool waits for a connection to be released back to the pool.- Specified by:
getConnectionWaitTimeout
in interfacePoolDataSource
- Returns:
- The connection wait timeout.
-
setTimeToLiveConnectionTimeout
public void setTimeToLiveConnectionTimeout(int timeToLiveConnectionTimeout) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the maximum time (in seconds) a connection may remain in-use.The range of valid values is 0 to
Integer.MAX_VALUE
. Defaults to 0.Setting the value to 0 disables time-to-live connection timeout processing.
- Specified by:
setTimeToLiveConnectionTimeout
in interfacePoolDataSource
- Parameters:
timeToLiveConnectionTimeout
- The maximum time (in seconds) a used connection may be active.- Throws:
java.sql.SQLException
- in case of inability to set timeout.
-
getTimeToLiveConnectionTimeout
public int getTimeToLiveConnectionTimeout()
Description copied from interface:PoolDataSource
Gets the maximum time (in seconds) a connection may remain in-use. When this timeout expires, the used connection is unconditionally returned to the connection pool. A value of 0 means that the feature is not enabled.- Specified by:
getTimeToLiveConnectionTimeout
in interfacePoolDataSource
- Returns:
- The maximum time (in seconds) a used connection may be active.
-
getAbandonedConnectionTimeout
public int getAbandonedConnectionTimeout()
Description copied from interface:PoolDataSource
Gets the abandoned connection timeout value.- Specified by:
getAbandonedConnectionTimeout
in interfacePoolDataSource
- Returns:
- The abandoned connection timeout.
-
setAbandonedConnectionTimeout
public void setAbandonedConnectionTimeout(int abandonedConnectionTimeout) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the abandoned connection timeout. This timeout determines how long a borrowed connection can remain unused before it is considered as abandoned and reclaimed by the connection pool.The range of valid values is 0 to
Integer.MAX_VALUE
. Defaults to 0.Setting the value to 0 disables abandoned connection timeout.
- Specified by:
setAbandonedConnectionTimeout
in interfacePoolDataSource
- Parameters:
abandonedConnectionTimeout
- The value of how long a connection has not been used before it is abandoned (in seconds).- Throws:
java.sql.SQLException
- in case of inability to set timeout.
-
setTimeoutCheckInterval
public void setTimeoutCheckInterval(int timeInterval) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the timeoutCheckInterval (in seconds). This interval specifies how often the timeout properties such as InactiveConnectionTimeout, AbandonedConnectionTimeout, and TimeToLiveConnectionTimeout are enforced.The range of valid values is 0 to
Integer.MAX_VALUE
. Defaults to 30.Setting the value to 0 disables all connection timeout processing.
- Specified by:
setTimeoutCheckInterval
in interfacePoolDataSource
- Parameters:
timeInterval
- The timeInterval (in seconds) between checks to enforce the timeout properties.- Throws:
java.sql.SQLException
- in case of inability to set interval.
-
getTimeoutCheckInterval
public int getTimeoutCheckInterval()
Description copied from interface:PoolDataSource
Gets the timeout check interval (in seconds).- Specified by:
getTimeoutCheckInterval
in interfacePoolDataSource
- Returns:
- timeInterval The
timeInterval
(in seconds) between checks to enforce the timeout properties.
-
setFastConnectionFailoverEnabled
public void setFastConnectionFailoverEnabled(boolean failoverEnabled) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Enables Fast Connection Failover (FCF) for the connection pool accessed using this pool-enabled data source. By default, FCF is disabled.- Specified by:
setFastConnectionFailoverEnabled
in interfacePoolDataSource
- Parameters:
failoverEnabled
-true
if Fast Connection Failover is enabled;false
if not.- Throws:
java.sql.SQLException
- in case of inability to set flag.
-
getFastConnectionFailoverEnabled
public boolean getFastConnectionFailoverEnabled()
Description copied from interface:PoolDataSource
Checks if Fast Connection Failover is enabled.- Specified by:
getFastConnectionFailoverEnabled
in interfacePoolDataSource
- Returns:
true
if Fast Connection Failover is enabled;false
if not.
-
getConnectionFactoryClassName
public java.lang.String getConnectionFactoryClassName()
Description copied from interface:PoolDataSource
Gets the Connection Factory class name.- Specified by:
getConnectionFactoryClassName
in interfacePoolDataSource
- Returns:
- Name of the connection factory class specified.
-
setConnectionFactoryClassName
public void setConnectionFactoryClassName(java.lang.String factoryClassName) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the Connection Factory class name. This is the connection factory used by the connection pool to create physical connections. Must be set forPoolDataSource
to operate.- Specified by:
setConnectionFactoryClassName
in interfacePoolDataSource
- Parameters:
factoryClassName
- Connection factory class name for obtaining physical connections.- Throws:
java.sql.SQLException
- in case of inability to set factory class name.
-
setMaxStatements
public void setMaxStatements(int maxStatements) throws java.sql.SQLException
Sets the maximum number of statements that may be pooled or cached on a connection. This is used to enable the statement pooling.- Specified by:
setMaxStatements
in interfacePoolDataSource
- Parameters:
maxStatements
- maximum number of statements to be pooled.- Throws:
java.sql.SQLException
- Exception occurred during the process of setting maximum statements that may be pooled on a connection.
-
getMaxStatements
public int getMaxStatements()
Gets the maximum number of statements that may be pooled or cached on a Connection.- Specified by:
getMaxStatements
in interfacePoolDataSource
- Returns:
- The maximum number of statements that may be pooled or cached on a Connection.
-
setMaxIdleTime
public void setMaxIdleTime(int idleTime) throws java.sql.SQLException
Sets Idle timeout for available connections in the pool.- Specified by:
setMaxIdleTime
in interfacePoolDataSource
- Parameters:
idleTime
- Idle timeout value in seconds.- Throws:
java.sql.SQLException
- in case of inability to set idle time.
-
getMaxIdleTime
public int getMaxIdleTime()
Gets Idle timeout value.- Specified by:
getMaxIdleTime
in interfacePoolDataSource
- Returns:
- Idle timeout.
-
setPropertyCycle
public void setPropertyCycle(int propertyCycle) throws java.sql.SQLException
Sets Property cycle in seconds. This is the time interval between checks to enforce connection pool timeout properties.- Specified by:
setPropertyCycle
in interfacePoolDataSource
- Parameters:
propertyCycle
- Time interval in seconds to enforce connection pool timeout properties.- Throws:
java.sql.SQLException
- in case of inability to set property cycle.
-
getPropertyCycle
public int getPropertyCycle()
Gets Property cycle in seconds.- Specified by:
getPropertyCycle
in interfacePoolDataSource
- Returns:
- PropertyCycle value.
-
setConnectionPoolName
public void setConnectionPoolName(java.lang.String connectionPoolName) throws java.sql.SQLException
Sets the connection pool name. This property allows the user to specify a String value to name a connection pool instance.- Specified by:
setConnectionPoolName
in interfacePoolDataSource
- Parameters:
connectionPoolName
- Name of connection pool.- Throws:
java.sql.SQLException
- in case of inability to set name.
-
getConnectionPoolName
public java.lang.String getConnectionPoolName()
Gets the connection pool name.- Specified by:
getConnectionPoolName
in interfacePoolDataSource
- Returns:
- connectionpoolName.
-
setValidateConnectionOnBorrow
public void setValidateConnectionOnBorrow(boolean validateConnectionOnBorrow) throws java.sql.SQLException
Sets whether or not a connection being borrowed should first be validated.- Specified by:
setValidateConnectionOnBorrow
in interfacePoolDataSource
- Parameters:
validateConnectionOnBorrow
- Whether or not a connection being borrowed should first be validated.- Throws:
java.sql.SQLException
- in case of inability to set flag.
-
getValidateConnectionOnBorrow
public boolean getValidateConnectionOnBorrow()
Returns whether or not a connection being borrowed should first be validated.- Specified by:
getValidateConnectionOnBorrow
in interfacePoolDataSource
- Returns:
- Whether or not a connection being borrowed should first be validated.
-
setSQLForValidateConnection
public void setSQLForValidateConnection(java.lang.String SQLString) throws java.sql.SQLException
Sets the value(SQL) for SQLForValidateConnection property. This is used in conjunction with the ValidateConnectionOnBorrow property. The SQL specified should be applicable to back end database and the JDBC driver configured.- Specified by:
setSQLForValidateConnection
in interfacePoolDataSource
- Parameters:
SQLString
- The SQL string used for connection validation.- Throws:
java.sql.SQLException
- in case of inability to set SQL string.
-
getSQLForValidateConnection
public java.lang.String getSQLForValidateConnection()
Gets the Value for SQLForValidateConnection property.- Specified by:
getSQLForValidateConnection
in interfacePoolDataSource
- Returns:
- SQLForValidateConnection value.
-
getConnectionHarvestTriggerCount
public int getConnectionHarvestTriggerCount()
Gets the number of available connections at which the connection pool's connection harvesting will occur.- Specified by:
getConnectionHarvestTriggerCount
in interfacePoolDataSource
- Returns:
- The number of available connections at which the connection pool's connection harvesting will occur.
-
setConnectionHarvestTriggerCount
public void setConnectionHarvestTriggerCount(int connectionHarvestTriggerCount) throws java.sql.SQLException
Sets the number of available connections at which the connection pool's connection harvesting will occur.- Specified by:
setConnectionHarvestTriggerCount
in interfacePoolDataSource
- Parameters:
connectionHarvestTriggerCount
- The number of available connections at which the connection pool's connection harvesting will occur.- Throws:
java.sql.SQLException
- in case of inability to set that count.
-
getConnectionHarvestMaxCount
public int getConnectionHarvestMaxCount()
Gets the maximum number of connections that may be harvested when the connection harvesting occurs. Note that it is possible that the number of connections that are harvested may be anywhere from 0 to the connectionHarvestMaxCount.- Specified by:
getConnectionHarvestMaxCount
in interfacePoolDataSource
- Returns:
- The maximum number of connections that may be harvested when the connection harvesting occurs.
-
setConnectionHarvestMaxCount
public void setConnectionHarvestMaxCount(int connectionHarvestMaxCount) throws java.sql.SQLException
Sets the maximum number of connections that may be harvested when the connection harvesting occurs.- Specified by:
setConnectionHarvestMaxCount
in interfacePoolDataSource
- Parameters:
connectionHarvestMaxCount
- the maximum number of connections that may be harvested when the connection harvesting occurs.- Throws:
java.sql.SQLException
- in case of inability to set that count.
-
getMaxConnectionReuseTime
public long getMaxConnectionReuseTime()
Gets the connection reuse time property.- Specified by:
getMaxConnectionReuseTime
in interfacePoolDataSource
- Returns:
- connection reuse time (in seconds), 0 value means that the feature is disabled.
-
setMaxConnectionReuseTime
public void setMaxConnectionReuseTime(long maxConnectionReuseTime) throws java.sql.SQLException
Gets the connection reuse time property.- Specified by:
setMaxConnectionReuseTime
in interfacePoolDataSource
- Parameters:
maxConnectionReuseTime
- reuse time (in seconds), 0 value means that the feature is disabled.- Throws:
java.sql.SQLException
- in case of inability to set reuse time.
-
getMaxConnectionReuseCount
public int getMaxConnectionReuseCount()
Gets the connection reuse count property.- Specified by:
getMaxConnectionReuseCount
in interfacePoolDataSource
- Returns:
- connection reuse count, 0 value means that the feature is disabled.
-
setMaxConnectionReuseCount
public void setMaxConnectionReuseCount(int maxConnectionReuseCount) throws java.sql.SQLException
Gets the connection reuse count property.- Specified by:
setMaxConnectionReuseCount
in interfacePoolDataSource
- Parameters:
maxConnectionReuseCount
- reuse count, 0 value means that the feature is disabled.- Throws:
java.sql.SQLException
- in case of inability to set reuse time.
-
getAvailableConnectionsCount
public int getAvailableConnectionsCount()
Gets the number of available connections in the pool.- Specified by:
getAvailableConnectionsCount
in interfacePoolDataSource
- Returns:
- AvailableConnectionsCount.
-
getBorrowedConnectionsCount
public int getBorrowedConnectionsCount()
Gets the number of borrowed connections from the pool.- Specified by:
getBorrowedConnectionsCount
in interfacePoolDataSource
- Returns:
- BorrowedConnectionsCount.
-
getONSConfiguration
public java.lang.String getONSConfiguration()
Returns the ONS configuration string that is used for remote ONS subscription, in the form specified in setONSConfiguration(String). This is used by Fast Connection Failover and Runtime Load Balancing.- Specified by:
getONSConfiguration
in interfacePoolDataSource
- Returns:
- The ONS configuration string used for remote ONS subscription.
-
setONSConfiguration
public void setONSConfiguration(java.lang.String onsConfigStr)
Sets the configuration string used for remote ONS subscription. The parameter string closely resembles the content of the ONS configuration file "ons.config", and contains a list of "name=value" pairs separated by newline character '\n', where name can be one of "nodes", "walletfile", or "walletpassword". The parameter string should at least specify the ONS configuration attribute "nodes", as a list of host:port pairs separated by comma ','. SSL would be used when the "walletfile" attribute is specified as an Oracle wallet file.An example ONS configuration string:
"nodes=host1:4200,host2:4200\nwalletfile=wfile\nwalletpassword=wpwd"
This is used primarily by Fast Connection Failover and Runtime Load Balancing.
- Specified by:
setONSConfiguration
in interfacePoolDataSource
- Parameters:
onsConfigStr
- The configuration string for remote ONS subscription.
-
registerConnectionLabelingCallback
public void registerConnectionLabelingCallback(ConnectionLabelingCallback cbk) throws java.sql.SQLException
Registers a ConnectionLabelingCallback with the underlying connection pool.- Specified by:
registerConnectionLabelingCallback
in interfacePoolDataSource
- Parameters:
cbk
- The ConnectionLabelingCallback object to be registered.- Throws:
java.sql.SQLException
- If there is a callback already registered with the pool.
-
removeConnectionLabelingCallback
public void removeConnectionLabelingCallback() throws java.sql.SQLException
Removes the ConnectionLabelingCallback object registered with the underlying connection pool, if any.- Specified by:
removeConnectionLabelingCallback
in interfacePoolDataSource
- Throws:
java.sql.SQLException
- If callback removal fails.
-
registerConnectionAffinityCallback
public void registerConnectionAffinityCallback(ConnectionAffinityCallback cbk) throws java.sql.SQLException
Registers a ConnectionAffinityCallback on the connection pool.- Specified by:
registerConnectionAffinityCallback
in interfacePoolDataSource
- Parameters:
cbk
- Affinity Callback object that must be registered.- Throws:
java.sql.SQLException
- If callback registration fails.
-
removeConnectionAffinityCallback
public void removeConnectionAffinityCallback() throws java.sql.SQLException
Removes the ConnectionAffinityCallback registered on the connection pool.- Specified by:
removeConnectionAffinityCallback
in interfacePoolDataSource
- Throws:
java.sql.SQLException
- If callback removal fails.
-
getStatistics
public JDBCConnectionPoolStatistics getStatistics()
Gets the statistics of the connection pool.- Specified by:
getStatistics
in interfacePoolDataSource
- Returns:
- The statistics of the connection pool.
-
getServiceName
public java.lang.String getServiceName()
Gets the service name set on this data source- Specified by:
getServiceName
in interfacePoolDataSource
- Returns:
- service name on this data source
-
getConnectionProperties
public java.util.Properties getConnectionProperties()
Gets the connection properties that are set on this data source.- Specified by:
getConnectionProperties
in interfacePoolDataSource
- Returns:
- Connection properties.
-
getConnectionProperty
public java.lang.String getConnectionProperty(java.lang.String propertyName)
Gets the specified connection property that are set on this data source.- Specified by:
getConnectionProperty
in interfacePoolDataSource
- Parameters:
propertyName
- The name of the specified property.- Returns:
- The value of the inquired connection property. Null if the property is not set.
-
setConnectionProperty
public void setConnectionProperty(java.lang.String name, java.lang.String value) throws java.sql.SQLException
Sets a connection property on the connection factory. This is used only for DataSource connection factories that also support connection properties; for example, theoracle.jdbc.pool.OracleDataSource
in the Oracle JDBC driver.- Specified by:
setConnectionProperty
in interfacePoolDataSource
- Parameters:
name
- The name of the connection property to be set on the connection factory class.value
- The value of the connection property to be set on the connection factory class.- Throws:
java.sql.SQLException
- If any exception occurred while setting the connection property.- See Also:
setConnectionFactoryProperties(java.util.Properties)
-
setConnectionProperties
public void setConnectionProperties(java.util.Properties connectionProperties) throws java.sql.SQLException
Sets the connection properties on the connection factory. This is used only for DataSource connection factories that also support connection properties; for example, theoracle.jdbc.pool.OracleDataSource
in the Oracle JDBC driver.- Specified by:
setConnectionProperties
in interfacePoolDataSource
- Parameters:
connectionProperties
- Connection properties to be set on the connection factory class.- Throws:
java.sql.SQLException
- If any exception occurred while setting the connection properties.- See Also:
setConnectionFactoryProperties(java.util.Properties)
-
getConnectionFactoryProperties
public java.util.Properties getConnectionFactoryProperties()
Gets the connection factory properties that are set on this data source.- Specified by:
getConnectionFactoryProperties
in interfacePoolDataSource
- Returns:
- Connection factory properties.
-
getConnectionFactoryProperty
public java.lang.String getConnectionFactoryProperty(java.lang.String propertyName)
Gets the specified connection factory property that are set on this data source.- Specified by:
getConnectionFactoryProperty
in interfacePoolDataSource
- Parameters:
propertyName
- The name of the specified property.- Returns:
- The value of the inquired connection factory property. Null if the property is not set.
-
setConnectionFactoryProperty
public void setConnectionFactoryProperty(java.lang.String name, java.lang.String value) throws java.sql.SQLException
Sets a connection factory property on the connection factory.For connection factories that implement
java.sql.Driver
, the connection factory property specified here will be assumed as a connection property.For DataSource connection factories, the property specified here will be assumed as a DataSource property.
- Specified by:
setConnectionFactoryProperty
in interfacePoolDataSource
- Parameters:
name
- The name of the connection factory property to be set on the connection factory class.value
- The value of the connection factory property to be set on the connection factory class.- Throws:
java.sql.SQLException
- If any exception occurred while setting the connection factory property.java.lang.IllegalArgumentException
- If the property name or value is invalid.
-
setConnectionFactoryProperties
public void setConnectionFactoryProperties(java.util.Properties factoryProperties) throws java.sql.SQLException
Sets the connection factory properties on the connection factory.For connection factories that implement
java.sql.Driver
, the connection factory properties specified here will be assumed as the connection properties.For DataSource connection factories, the properties specified here will be assumed as the DataSource properties.
- Specified by:
setConnectionFactoryProperties
in interfacePoolDataSource
- Parameters:
factoryProperties
- Connection factory properties to be set on the connection factory class.- Throws:
java.sql.SQLException
- If any exception occurred while setting the connection factory properties.java.lang.IllegalArgumentException
- If factoryProperties is empty.
-
isSetOnceProperty
public static boolean isSetOnceProperty(java.lang.String key)
Authentication kays to enforce to be set up once per a single pool data source- Parameters:
key
- to check- Returns:
- true, if authentication key
-
toBasicType
public static java.lang.Object toBasicType(java.lang.String value, java.lang.String type)
-
getReference
public javax.naming.Reference getReference()
- Specified by:
getReference
in interfacejavax.naming.Referenceable
-
getObjectInstance
public java.lang.Object getObjectInstance(java.lang.Object refObj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable<?,?> env) throws java.lang.Exception
- Specified by:
getObjectInstance
in interfacejavax.naming.spi.ObjectFactory
- Throws:
java.lang.Exception
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
Since this class is not a wrapper, just check to see if this implements the requested interface.- Specified by:
isWrapperFor
in interfacejava.sql.Wrapper
- Parameters:
iface
- Requested interface.- Returns:
- true If this implements the requested interface.
- Throws:
java.sql.SQLException
- If the argument is not an interface.- Since:
- JDBC 4.0
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
Since this class is not a wrapper, just check to see if this implements the requested interface.- Specified by:
unwrap
in interfacejava.sql.Wrapper
- Parameters:
iface
- Requested interface.- Returns:
- this If this implements the requested interface.
- Throws:
java.sql.SQLException
- If this does not implement the arg or the arg is not an interface.- Since:
- JDBC 4.0
-
registerConnectionInitializationCallback
public void registerConnectionInitializationCallback(ConnectionInitializationCallback cbk) throws java.sql.SQLException
Registers a connection initialization callback.- Specified by:
registerConnectionInitializationCallback
in interfacePoolDataSource
- Parameters:
cbk
- TheConnectionInitializationCallback
object to be registered.- Throws:
java.sql.SQLException
- If there is a callback already registered with the pool.
-
unregisterConnectionInitializationCallback
public void unregisterConnectionInitializationCallback() throws java.sql.SQLException
Unregisters the connection initialization callback on this pool.- Specified by:
unregisterConnectionInitializationCallback
in interfacePoolDataSource
- Throws:
java.sql.SQLException
- If callback removal fails.
-
getConnectionInitializationCallback
public ConnectionInitializationCallback getConnectionInitializationCallback()
Obtains the registered connection initialization callback, if any.- Specified by:
getConnectionInitializationCallback
in interfacePoolDataSource
- Returns:
- The registered
ConnectionInitializationCallback
, or null if there is no callback registered.
-
getConnectionLabelingHighCost
public int getConnectionLabelingHighCost()
Description copied from interface:PoolDataSource
Obtains the cost value which identifies a connection as "high-cost" for connection labeling.- Specified by:
getConnectionLabelingHighCost
in interfacePoolDataSource
- Returns:
- The cost value that identifies a connection as "high-cost" for connection labeling.
- See Also:
PoolDataSource.setConnectionLabelingHighCost(int)
-
setConnectionLabelingHighCost
public void setConnectionLabelingHighCost(int highCost) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the cost value which identifies a connection as "high-cost" for connection labeling. Connection labeling uses thecost(Properties, Properties)
method in ConnectionLabelingCallback to find a connection in the pool for a request. When this property is set, connections with a cost value equal to or greater than the property value are considered "high-cost" connections. The default value is Integer.MAX_VALUE.- Specified by:
setConnectionLabelingHighCost
in interfacePoolDataSource
- Parameters:
highCost
- The cost value that identifies a connection as "high-cost" for connection labeling.- Throws:
java.sql.SQLException
- If an exception occurs while setting the cost.
-
getConnectionRepurposeThreshold
public int getConnectionRepurposeThreshold()
Description copied from interface:PoolDataSource
Gets the connection repurpose threshold for the pool. This property is used in cases when the connection pool is shared by multiple datasources connecting to the same database but using different services.Only when this threshold is reached the pool will try to repurpose connections between different services before trying to create new connections. This property is applicable only for multi-tenant databases.- Specified by:
getConnectionRepurposeThreshold
in interfacePoolDataSource
- Returns:
- connection repurpose threshold property value currently set.
-
setConnectionRepurposeThreshold
public void setConnectionRepurposeThreshold(int threshold) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the connection repurpose threshold for the pool. This property is applicable only for multi-tenant databases.- Specified by:
setConnectionRepurposeThreshold
in interfacePoolDataSource
- Parameters:
threshold
- connection repurpose threshold to set.- Throws:
java.sql.SQLException
- If any exception occurs while setting the threshold.- See Also:
PoolDataSource.getConnectionRepurposeThreshold()
-
getHighCostConnectionReuseThreshold
public int getHighCostConnectionReuseThreshold()
Description copied from interface:PoolDataSource
Obtains the high-cost connection reuse threshold property value for connection labeling.- Specified by:
getHighCostConnectionReuseThreshold
in interfacePoolDataSource
- Returns:
- The high-cost connection reuse threshold property value currently set.
- See Also:
PoolDataSource.setConnectionLabelingHighCost(int)
,PoolDataSource.setHighCostConnectionReuseThreshold(int)
-
setHighCostConnectionReuseThreshold
public void setHighCostConnectionReuseThreshold(int threshold) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the high-cost connection reuse threshold for connection labeling. This property works together with the ConnectionLabelingHighCost property to determine when high-cost connections are reused for connection labeling. This property specifies a threshold of the number of total connections in the pool. If Connection Labeling finds all available connections are high-cost connections (i.e., the lowest cost value exceeds the ConnectionLabelingHighCost value), it checks this threshold to determine whether to reuse those connections. Only when this threshold is reached, Connection Labeling will try to reuse the high-cost connections in the pool to serve a labeled connection request. Otherwise, Connection Labeling picks a low-cost connection, a no-label connection available in the pool, or creates a brand-new physical connection to serve a labeled request. For example, if the property value is set to 10, Connection Labeling reuses high-cost connections when there are no low-cost connections available and the total connections reach 10. Note that any labeled connection with cost Integer.MAX_VALUE will not be reused. This is consistent with connection labeling behavior when this property and ConnectionLabelingHighCost are not set. A Connection Labeling callback must be registered at the same time for this property to take effect. The default value is 0, which is treated the same way as MinPoolSize.- Specified by:
setHighCostConnectionReuseThreshold
in interfacePoolDataSource
- Parameters:
threshold
- The high-cost connection reuse threshold to set.- Throws:
java.sql.SQLException
- If any exception occurs while setting the threshold.
-
getPdbRoles
public java.util.Properties getPdbRoles()
Gets the PDB roles specified for this datasource- Specified by:
getPdbRoles
in interfacePoolDataSource
- Returns:
- roles key values pairs that correspond to the role names and password that are set for this datasource
- See Also:
setPdbRoles(java.util.Properties)
-
getSecondsToTrustIdleConnection
public int getSecondsToTrustIdleConnection()
Gets the seconds To Trust Idle Connection value. See property description insetSecondsToTrustIdleConnection()
.- Specified by:
getSecondsToTrustIdleConnection
in interfacePoolDataSource
- Returns:
- Seconds To Trust Idle Connection value.
-
setSecondsToTrustIdleConnection
public void setSecondsToTrustIdleConnection(int secondsToTrustIdleConnection) throws java.sql.SQLException
Sets the time in seconds to trust an idle connection to skip a validation test. It works in conjunction withsetValidateConnectionOnBorrow(boolean)
. When set to any positive value, a connection validation during the checkout is skipped if the connection was successfully used and returned to the pool within the time specified for secondsToTrustIdleConnection. Default value is set to 0 seconds which means that the feature is disabled.- Specified by:
setSecondsToTrustIdleConnection
in interfacePoolDataSource
- Parameters:
secondsToTrustIdleConnection
- The value of how long a connection can be trusted to skip connectionValidationOnBorrow- Throws:
java.sql.SQLException
- in case of inability to set these seconds.
-
createConnectionBuilder
public UCPConnectionBuilder createConnectionBuilder()
Description copied from interface:PoolDataSource
Creates a new UCPConnectionBuilder instance.- Specified by:
createConnectionBuilder
in interfacejavax.sql.DataSource
- Specified by:
createConnectionBuilder
in interfacePoolDataSource
- Returns:
- Connection builder that builds OracleConnection
- See Also:
PoolDataSource.createConnectionBuilder()
-
getParentLogger
public java.util.logging.Logger getParentLogger()
- Specified by:
getParentLogger
in interfacejavax.sql.CommonDataSource
- Returns:
- null
- See Also:
CommonDataSource.getParentLogger()
-
getQueryTimeout
public int getQueryTimeout()
Gets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds.- Specified by:
getQueryTimeout
in interfacePoolDataSource
- Returns:
- The query timeout in seconds
-
setQueryTimeout
public void setQueryTimeout(int queryTimeout) throws java.sql.SQLException
Sets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds.- Specified by:
setQueryTimeout
in interfacePoolDataSource
- Parameters:
queryTimeout
- in seconds- Throws:
java.sql.SQLException
- in case of inability to set that timeout.
-
getMaxConnectionsPerShard
public int getMaxConnectionsPerShard()
Gets the currently configured max connections that can be created per shard in a sharded database configuration.- Specified by:
getMaxConnectionsPerShard
in interfacePoolDataSource
- Returns:
- The configured max number of connections that can be created per shard.
-
setMaxConnectionsPerShard
public void setMaxConnectionsPerShard(int maxConnectionsPerShard) throws java.sql.SQLException
Sets the max number of connections that can be created per shard in a sharded database configuration. (Note: This configuration is not compatible with Sharded database configured with Oracle Golden gate)- Specified by:
setMaxConnectionsPerShard
in interfacePoolDataSource
- Parameters:
maxConnectionsPerShard
- The max number of connections that can be created per shard- Throws:
java.sql.SQLException
- if there is an any exception while setting this parameter
-
setShardingMode
public void setShardingMode(boolean shardingMode) throws java.sql.SQLException
This API changes the mode of UCP when UCP is using a Sharded Database. By default UCP requires the caller to provide a sharding key for every connection request. When switching off the sharding mode, UCP behaves like a regular connection pool and all the sharding features are disabled so that a caller can request a connection without providing any sharding key.- Specified by:
setShardingMode
in interfacePoolDataSource
- Parameters:
shardingMode
- Mode of UCP when using a Sharded Database.- Throws:
java.sql.SQLException
- in case of inability to set sharding mode.
-
getShardingMode
public boolean getShardingMode()
Returns the mode of UCP when UCP is using a Sharded Database. By default sharding mode is ON which means UCP requires the caller to provide a sharding key for every connection request.- Specified by:
getShardingMode
in interfacePoolDataSource
- Returns:
- Mode of UCP when using a Sharded Database.
-
setConnectionValidationTimeout
public void setConnectionValidationTimeout(int connectionValidationTimeout) throws java.sql.SQLException
Description copied from interface:PoolDataSource
This property changes the connection validation timeout which is specified in seconds. Default is 15 seconds. This is the maximum time for connection validation operation. If not completed during this timeout, the connection is treated as invalid.- Specified by:
setConnectionValidationTimeout
in interfacePoolDataSource
- Parameters:
connectionValidationTimeout
- timeout to validate connection- Throws:
java.sql.SQLException
- if tiomeout is negative- See Also:
PoolDataSource.setConnectionValidationTimeout(int)
-
getConnectionValidationTimeout
public int getConnectionValidationTimeout()
Description copied from interface:PoolDataSource
Connection validation timeout getter- Specified by:
getConnectionValidationTimeout
in interfacePoolDataSource
- Returns:
- the current connection validation timaout value in seconds
- See Also:
PoolDataSource.getConnectionValidationTimeout()
-
setSSLContext
public void setSSLContext(javax.net.ssl.SSLContext sslContext)
Description copied from interface:PoolDataSource
Specifies aSSLContext
to use as a factory for SSLEngine objects that carry out the TLS protocol.The SSLContext must be initialized before setting it on PoolDataSource. The certificates specified by that initialization will be used in place of any connection properties that would otherwise have specified certificates, such as oracle.jdbc.OracleConnection#CONNECTION_PROPERTY_KEYSTORE key store and oracle.jdbc.OracleConnection#CONNECTION_PROPERTY_TRUSTSTORE trust store property values.
- Specified by:
setSSLContext
in interfacePoolDataSource
- Parameters:
sslContext
- SSLContext instance to be used as an SSLEngine factory.- See Also:
PoolDataSource.setSSLContext(SSLContext)
-
getSSLContext
protected javax.net.ssl.SSLContext getSSLContext()
Returns SSL context associated with the datasource.- Returns:
- SSL context
-
setHostnameResolver
public void setHostnameResolver(PoolDataSource.HostnameResolver hostnameResolver)
Description copied from interface:PoolDataSource
Specifies aPoolDataSource#HostnameResolver
to use by the pool- Specified by:
setHostnameResolver
in interfacePoolDataSource
- Parameters:
hostnameResolver
- HostnameResolver instance to be used as a custom DNS name resolver.- See Also:
PoolDataSource.setHostnameResolver(HostnameResolver)
-
getHostnameResolver
protected PoolDataSource.HostnameResolver getHostnameResolver()
Returns the hostname resolver associated with this datasource- Returns:
- Hostname Resolver
-
isReadOnlyInstanceAllowed
public boolean isReadOnlyInstanceAllowed()
Description copied from interface:PoolDataSource
Returns true if the connection borrow is allowed to a read-only instance, false otherwise. This property is applicable to sharded database only. A shard instance can be in read-only mode for a chunk if chunk move/split operation is in progress.- Specified by:
isReadOnlyInstanceAllowed
in interfacePoolDataSource
- Returns:
- true if the connection borrow is allowed to a read-only instance, false otherwise.
- See Also:
PoolDataSource.isReadOnlyInstanceAllowed()
-
setReadOnlyInstanceAllowed
public void setReadOnlyInstanceAllowed(boolean readOnlyInstanceAllowed) throws java.sql.SQLException
Description copied from interface:PoolDataSource
Sets the read-only instance allowed value on the datasource. This property is applicable to sharded database only. When the property value is set to true, UCP allows connection borrow to read-only instances as well otherwise not. A shard instance goes into read-only mode for a chunk if the chunk move/split operation is in progress on that instance. The default value is false which means by default connection borrow is not allowed to a read-only instance.- Specified by:
setReadOnlyInstanceAllowed
in interfacePoolDataSource
- Parameters:
readOnlyInstanceAllowed
- whether to allow connection borrow to a read-only instance or not- Throws:
java.sql.SQLException
- if unable to set property value- See Also:
PoolDataSource#setReadOnlyInstanceAllowed(readOnlyInstanceAllowed)
-
setTokenSupplier
public final void setTokenSupplier(java.util.function.Supplier<? extends oracle.jdbc.AccessToken> tokenSupplier) throws java.sql.SQLException
Sets a supplier function that generates an access token when creating a connection with this
DataSource
. The supplier function is invoked each time thisDataSource
creates a connection. Instances ofAccessToken
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 ofsetUser(String)
,setPassword(String)
,setConnectionProperties(java.util.Properties)
, orsetConnectionProperty(String, String)
have configured thisDataSource
with a user name or password, and an invocation of this method has also configured a token supplier, then aSQLException
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 safeSupplier
that caches tokens from a user definedSupplier
.- Specified by:
setTokenSupplier
in interfacePoolDataSource
- Parameters:
tokenSupplier
- Token supplying function. Notnull
.- Throws:
java.lang.NullPointerException
- If thetokenSupplier
is null.java.sql.SQLException
- if unable to set property value
-
ilogFinest
protected void ilogFinest(java.util.logging.Logger logger, java.lang.Class<?> cls, java.lang.reflect.Executable method, java.lang.Object receiver, java.lang.String message)
Helpers for writing into log and logWriter- Parameters:
logger
- to use;cls
- class to use;method
- to use;receiver
- "this" object to use;message
- message to display.
-
ilogFine
protected void ilogFine(java.util.logging.Logger logger, java.lang.Class<?> cls, java.lang.reflect.Executable method, java.lang.Object receiver, java.lang.String message)
-
ilogWarning
protected void ilogWarning(java.util.logging.Logger logger, java.lang.Class<?> cls, java.lang.reflect.Executable method, java.lang.Object receiver, java.lang.String message)
-
ilogSevere
protected void ilogSevere(java.util.logging.Logger logger, java.lang.Class<?> cls, java.lang.reflect.Executable method, java.lang.Object receiver, java.lang.String message)
-
ilogThrowing
protected void ilogThrowing(java.util.logging.Logger logger, java.lang.Class<?> cls, java.lang.reflect.Executable method, java.lang.Object receiver, java.lang.Throwable throwable)
-
-