Class PoolDataSourceImpl
- All Implemented Interfaces:
Serializable,Wrapper,Referenceable,ObjectFactory,CommonDataSource,DataSource,Diagnosable,PoolDataSource,UniversalConnectionPoolAdapter
- Direct Known Subclasses:
PoolXADataSourceImpl
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.
Starting in 23.4, new connections are created in the background instead of the user thread. A borrow request may trigger a new connection creation when there is no connection available at the time of the request and if there is room to grow the pool. The borrow request may be satisfied by either a brand new connection created by the background thread or by a connection that was just returned to the pool ??? whichever event happens first. If the connection borrow request can't be satisfied within the Connection Wait Timeout (CWT) then a UniveralConnectionPoolException will be thrown with error code UCP-29.
This behavior is different from 19c or 21c in that:
1. If CWT=0 (or a very small value), a borrow request has a higher chance to throw an exception because it will not give enough time to create a new JDBC connection. A borrow request with CWT=0 can only return a connection if there is one immediately available in the pool.
2. A UCP exception thrown by the connection request will not include the JDBC exception as a cause.
To troubleshoot situations where the driver can't connect to the Database, you can implement
the ConnectionCreationInformation callback.
A new system property "oracle.ucp.createConnectionInBorrowThread" can be set to "true" to switch back to the old behavior where connections are created in the user thread.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classNested classes/interfaces inherited from interface oracle.ucp.jdbc.PoolDataSource
PoolDataSource.HostnameResolver -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Patternstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface oracle.ucp.jdbc.PoolDataSource
SYSTEM_PROPERTY_AFFINITY_STRICT, SYSTEM_PROPERTY_BEGIN_REQUEST_AT_CONNECTION_CREATION, SYSTEM_PROPERTY_CONNECTION_CREATION_RETRY_DELAY, SYSTEM_PROPERTY_CREATE_CONNECTION_IN_BORROW_THREAD, SYSTEM_PROPERTY_DESTROY_ON_RELOAD, SYSTEM_PROPERTY_DIAGNOSTIC_BUFFER_SIZE, SYSTEM_PROPERTY_DIAGNOSTIC_ENABLE_LOGGING, SYSTEM_PROPERTY_DIAGNOSTIC_ENABLE_TRACE, SYSTEM_PROPERTY_DIAGNOSTIC_ERROR_CODES_TO_WATCH_LIST, SYSTEM_PROPERTY_DIAGNOSTIC_LOGGING_LEVEL, SYSTEM_PROPERTY_ENABLE_SHUTDOWN_HOOK, SYSTEM_PROPERTY_FAN_ENABLED, SYSTEM_PROPERTY_IMITATE_ASYNC_BORROW, SYSTEM_PROPERTY_MAX_INIT_THREADS, SYSTEM_PROPERTY_PRE_WLS1212_COMPATIBLE, SYSTEM_PROPERTY_RLB_INOPERABILITY_TIMEOUT, SYSTEM_PROPERTY_SELFTUNING, SYSTEM_PROPERTY_TIMERS_AFFECT_ALL_CONNECTIONS, SYSTEM_PROPERTY_WLS_JTA, SYSTEM_PROPERTY_XML_CONFIG_FILE, UCP_ABANDONED_CONNECTION_TIMEOUT, UCP_COMMIT_ON_CONNECTION_RETURN, UCP_CONNECTION_AFFINITY_CALLBACK, UCP_CONNECTION_CREATION_CONSUMER, 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_DURATION, UCP_CONNECTION_WAIT_TIMEOUT, UCP_CREATE_CONNECTION_IN_BORROW_THREAD, 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_IDLE, 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 -
Method Summary
Modifier and TypeMethodDescriptionCreates a new UCPConnectionBuilder instance.protected voidCreates a Universal Connection Pool instance using this adapter.Creates a Universal Connection Pool MBean using this adapter.intGets the abandoned connection timeout value.intGets the number of available connections in the pool.intGets the number of borrowed connections from the pool.Attempts to obtain a database connection.getConnection(String username, String password) Attempts to obtain a database connection.getConnection(String username, String password, Properties labels) Attempts to obtain a database connection with the requested connection labels.getConnection(Properties labels) Attempts to obtain a database connection with the requested connection labels.protected ConnectiongetConnection(oracle.ucp.jdbc.UCPConnectionBuilderImpl builder) Internal method that attempts to obtain a database connection with the parameters set on the builder.Consumer<oracle.ucp.ConnectionCreationInformation>Obtains the registered connection creation Consumer, if any.Gets the Connection Factory class name.Gets the connection factory properties that are set on this data source.getConnectionFactoryProperty(String propertyName) Gets the specified connection factory property that are set on this data source.intGets the maximum number of connections that may be harvested when the connection harvesting occurs.intGets the number of available connections at which the connection pool's connection harvesting will occur.Obtains the registered connection initialization callback, if any.intObtains the cost value which identifies a connection as "high-cost" for connection labeling.Gets the connection pool name.Gets the connection properties that are set on this data source.getConnectionProperty(String propertyName) Gets the specified connection property that is set on this data source.intGets the connection repurpose threshold for the pool.intConnection validation timeout getterGets the maximum time (in seconds) that any connection borrow request can wait before it returns to the application.longintDeprecated.Gets the database name.Gets the data source name.Gets the data source description.Related diagnosable objectbooleanChecks if Fast Connection Failover is enabled.intObtains the high-cost connection reuse threshold property value for connection labeling.Returns the hostname resolver associated with this datasourceintGets the inactive connection timeout.intGets the initial pool size.intGets the default maximum time in seconds that a driver will wait while attempting to connect to a database once the driver has been identified.intGets the connection reuse count property.longGets the connection reuse time property.intGets the maximum number of connections that can be obtained to a particular service, in a shared pool.intGets the currently configured max connections that can be created per shard in a sharded database configuration.intGets Idle timeout value.intGets the maximum number of connections that the connection pool will maintain.intGets the maximum number of statements that may be pooled or cached on a Connection.intGets the minimum number of idle connections that the connection pool will maintain.intGets the minimum number of connections that the connection pool will maintain.Gets the datasource networkProtocol.getObjectInstance(Object refObj, Name name, Context nameCtx, Hashtable<?, ?> env) Returns the ONS configuration string that is used for remote ONS subscription, in the form specified in setONSConfiguration(String).Gets the PDB roles specified for this datasourceintGets the database port number.intGets Property cycle in seconds.intGets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds.Gets the datasource role name.intGets the seconds To Trust Idle Connection value.Gets the database server name.Gets the service name set on this data sourcebooleanReturns the mode of UCP when UCP is using a Sharded Database.Gets the Value for SQLForValidateConnection property.protected SSLContextReturns SSL context associated with the datasource.Gets the statistics of the connection pool.intGets the timeout check interval (in seconds).intGets the maximum time (in seconds) a connection may remain in-use.getURL()Gets the URL for this data source.getUser()Gets the user name for this data source.booleanReturns whether or not a connection being borrowed should first be validated.booleanReturns the boolean value for the property that controls the behavior of UCP when a connection is released back to the pool with pending uncommitted changes in an active transaction.booleanReturns the connection creation mode: either "true" if connections are created using the borrowing thread, or "false" if connections are created in the background (the default).booleanReturns true if the connection borrow is allowed to a read-only instance, false otherwise.static booleanisSetOnceProperty(String key) Authentication kays to enforce to be set up once per a single pool data sourcebooleanisWrapperFor(Class<?> iface) Since this class is not a wrapper, just check to see if this implements the requested interface.voidreconfigureDataSource(Properties configuration) Reconfigures the data source.voidRegisters a ConnectionAffinityCallback on the connection pool.voidregisterConnectionCreationConsumer(Consumer<oracle.ucp.ConnectionCreationInformation> consumer) Registers a connection creation Consumer.voidRegisters a connection initialization callback.voidRegisters a ConnectionLabelingCallback with the underlying connection pool.voidRemoves the ConnectionAffinityCallback registered on the connection pool.voidRemoves the ConnectionLabelingCallback object registered with the underlying connection pool, if any.voidsetAbandonedConnectionTimeout(int abandonedConnectionTimeout) Sets the abandoned connection timeout.voidsetCommitOnConnectionReturn(boolean commit) Sets the boolean value for the property that controls the behavior of UCP when a connection is released back to the pool with pending uncommitted changes in an active transaction.voidsetConnectionFactoryClassName(String factoryClassName) Sets the Connection Factory class name.voidsetConnectionFactoryProperties(Properties factoryProperties) Sets the connection factory properties on the connection factory.voidsetConnectionFactoryProperty(String name, String value) Sets a connection factory property on the connection factory.voidsetConnectionHarvestMaxCount(int connectionHarvestMaxCount) Sets the maximum number of connections that may be harvested when the connection harvesting occurs.voidsetConnectionHarvestTriggerCount(int connectionHarvestTriggerCount) Sets the number of available connections at which the connection pool's connection harvesting will occur.voidsetConnectionLabelingHighCost(int highCost) Sets the cost value which identifies a connection as "high-cost" for connection labeling.voidsetConnectionPoolName(String connectionPoolName) Sets the connection pool name.voidsetConnectionProperties(Properties connectionProperties) Sets the connection properties on the connection factory.voidsetConnectionProperty(String name, String value) Sets a connection property on the connection factory.voidsetConnectionRepurposeThreshold(int threshold) Sets the connection repurpose threshold for the pool.voidsetConnectionValidationTimeout(int connectionValidationTimeout) This property changes the connection validation timeout which is specified in seconds.voidsetConnectionWaitDuration(Duration duration) Configures how much time a connection request call may wait before it either successfully returns a connection or throws an exception.voidsetConnectionWaitDurationInMillis(long duration) voidsetConnectionWaitTimeout(int waitTimeout) Deprecated.voidsetCreateConnectionInBorrowThread(boolean createConnectionInBorrowThread) Set this flag to true to make UCP use the borrowing thread to create new connections.voidsetDatabaseName(String databaseName) Sets the database name.voidsetDataSourceName(String dataSourceName) Sets the data source name.voidsetDescription(String dataSourceDescription) Sets the data source description.voidsetFastConnectionFailoverEnabled(boolean failoverEnabled) Enables Fast Connection Failover (FCF) for the connection pool accessed using this pool-enabled data source.voidsetHighCostConnectionReuseThreshold(int threshold) Sets the high-cost connection reuse threshold for connection labeling.voidsetHostnameResolver(PoolDataSource.HostnameResolver hostnameResolver) Specifies aPoolDataSource.HostnameResolverto use by the poolvoidsetInactiveConnectionTimeout(int inactivityTimeout) Sets the inactive connection timeout.voidsetInitialPoolSize(int initialPoolSize) Sets the initial pool size.voidsetLoginTimeout(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.voidsetLogWriter(PrintWriter logWriter) voidsetMaxConnectionReuseCount(int maxConnectionReuseCount) Gets the connection reuse count property.voidsetMaxConnectionReuseTime(long maxConnectionReuseTime) Gets the connection reuse time property.voidsetMaxConnectionsPerShard(int maxConnectionsPerShard) Sets the max number of connections that can be created per shard in a sharded database configuration.voidsetMaxIdleTime(int idleTime) Sets Idle timeout for available connections in the pool.voidsetMaxPoolSize(int maxPoolSize) Sets the maximum number of connections.voidsetMaxStatements(int maxStatements) Sets the maximum number of statements that may be pooled or cached on a connection.voidsetMinIdle(int minIdle) Sets the minimum number of idle connections.voidsetMinPoolSize(int minPoolSize) Sets the minimum number of connections.voidsetNetworkProtocol(String networkProtocol) Sets the datasource networkProtocol.voidsetONSConfiguration(String onsConfigStr) Sets the configuration string used for remote ONS subscription.voidsetPassword(String password) Sets the password with which connections have to be obtained.voidsetPortNumber(int portNumber) Sets the database port number.voidsetPropertyCycle(int propertyCycle) Sets Property cycle in seconds.voidsetQueryTimeout(int queryTimeout) Sets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds.voidsetReadOnlyInstanceAllowed(boolean readOnlyInstanceAllowed) Sets the read-only instance allowed value on the datasource.voidsetRoleName(String roleName) Sets the datasource role name.voidsetSecondsToTrustIdleConnection(int secondsToTrustIdleConnection) Sets the time in seconds to trust an idle connection to skip a validation test.voidsetServerName(String serverName) Sets the database server name.voidsetShardingMode(boolean shardingMode) This API changes the mode of UCP when UCP is using a Sharded Database.voidsetSQLForValidateConnection(String SQLString) Sets the value(SQL) for SQLForValidateConnection property.voidsetSSLContext(SSLContext sslContext) Specifies aSSLContextto use as a factory for SSLEngine objects that carry out the TLS protocol.voidsetTimeoutCheckInterval(int timeInterval) Sets the timeoutCheckInterval (in seconds).voidsetTimeToLiveConnectionTimeout(int timeToLiveConnectionTimeout) Sets the maximum time (in seconds) a connection may remain in-use.final voidsetTokenSupplier(Supplier<? extends oracle.jdbc.AccessToken> tokenSupplier) Sets a supplier function that generates an access token when creating a connection with thisDataSource.voidSets the URL that the data source uses to obtain connections to the database.voidSets the user name with which connections have to be obtained.voidsetValidateConnectionOnBorrow(boolean validateConnectionOnBorrow) Sets whether or not a connection being borrowed should first be validated.voidHelper to start pool without keeping metadata connection if initPoolSize is 0.voidstartPool(oracle.ucp.jdbc.JDBCConnectionRetrievalInfo cri) Helper to start pool without keeping metadata connection if initPoolSize is 0.protected voidstartPool(oracle.ucp.jdbc.JDBCConnectionRetrievalInfo cri, boolean keepMetadataConn) This helper method gets all the pool properties for pool initialization, creates a pool and starts it.static ObjecttoBasicType(String value, String type) voidUnregisters the connection creation Consumer on this pool.voidUnregisters the connection initialization callback on this pool.<T> TSince 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, waitMethods inherited from interface oracle.ucp.diagnostics.Diagnosable
beginCurrentSql, debug, debug, endCurrentSql, format, isLoggingLevelFinest, resumeLogging, secure, suspendLogging, trace, traceMethods inherited from interface oracle.ucp.jdbc.PoolDataSource
createShardingKeyBuilder, getPassword
-
Field Details
-
SECRET_STORE_CONNECT
- See Also:
-
SECRET_STORE_USERNAME
- See Also:
-
SECRET_STORE_PASSWORD
- See Also:
-
SECRET_STORE_DEFAULT_USERNAME
- See Also:
-
SECRET_STORE_DEFAULT_PASSWORD
- See Also:
-
COLOCATION_URL
-
-
Constructor Details
-
PoolDataSourceImpl
public PoolDataSourceImpl()
-
-
Method Details
-
startPool
Helper to start pool without keeping metadata connection if initPoolSize is 0.- Throws:
SQLException
-
startPool
Helper to start pool without keeping metadata connection if initPoolSize is 0.- Parameters:
cri- contains username/password for metadata connection creation.- Throws:
SQLException
-
startPool
protected void startPool(oracle.ucp.jdbc.JDBCConnectionRetrievalInfo cri, boolean keepMetadataConn) throws SQLException This helper method gets all the pool properties for pool initialization, creates a pool and starts it.- Parameters:
cri- contains username/password for metadata connection creation.keepMetadataConn- keep metadata connection in the working set even if init pool size is 0 (because the next operation will be "borrow").- Throws:
SQLException- if a database-access error occurs.
-
createPoolWithDefaultProperties
- Throws:
SQLException
-
createUniversalConnectionPool
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:
createUniversalConnectionPoolin interfaceUniversalConnectionPoolAdapter- Returns:
- The created Universal Connection Pool instance.
- Throws:
SQLException- If any error occurs during the process of connection pool creation.- See Also:
-
reconfigureDataSource
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:
reconfigureDataSourcein interfacePoolDataSource- Parameters:
configuration- the configuration input- Throws:
SQLException- If an error occurs while configuring the data source.
-
createUniversalConnectionPoolMBean
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:
createUniversalConnectionPoolMBeanin interfaceUniversalConnectionPoolAdapter- Returns:
- The created Universal Connection Pool MBean.
- See Also:
-
getConnection
Attempts to obtain a database connection.- Specified by:
getConnectionin interfaceDataSource- Returns:
- A Connection to the database.
- Throws:
SQLException- if a database-access error occurs.
-
getConnection
Attempts to obtain a database connection.- Specified by:
getConnectionin interfaceDataSource- 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:
SQLException- if a database-access error occurs.
-
getConnection
Attempts to obtain a database connection with the requested connection labels.- Specified by:
getConnectionin interfacePoolDataSource- Parameters:
labels- The requested connection labels.- Returns:
- A Connection to the database.
- Throws:
SQLException- if a database-access error occurs.
-
getConnection
public Connection getConnection(String username, String password, Properties labels) throws SQLException Attempts to obtain a database connection with the requested connection labels.- Specified by:
getConnectionin 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:
SQLException- if a database-access error occurs.
-
getConnection
protected Connection getConnection(oracle.ucp.jdbc.UCPConnectionBuilderImpl builder) throws SQLException Internal method that attempts to obtain a database connection with the parameters set on the builder.- Parameters:
builder- the builder object containing the connection properties- Returns:
- A Connection to the database.
- Throws:
SQLException- if a database-access error occurs.
-
getLogWriter
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
setLogWriter
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
setLoginTimeout
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:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Parameters:
seconds- timeout- Throws:
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:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Returns:
- timeout in seconds
-
getUser
Description copied from interface:PoolDataSourceGets the user name for this data source.- Specified by:
getUserin interfacePoolDataSource- Returns:
- userName for this data source.
-
setUser
Description copied from interface:PoolDataSourceSets the user name with which connections have to be obtained.- Specified by:
setUserin interfacePoolDataSource- Parameters:
username- Username to be set.- Throws:
SQLException- in case of inability to set user.
-
setPassword
Description copied from interface:PoolDataSourceSets the password with which connections have to be obtained.- Specified by:
setPasswordin interfacePoolDataSource- Parameters:
password- Password to be set.- Throws:
SQLException- in case of inability to set password.
-
getURL
Description copied from interface:PoolDataSourceGets the URL for this data source.- Specified by:
getURLin interfacePoolDataSource- Returns:
- URL for this data source.
-
setURL
Description copied from interface:PoolDataSourceSets the URL that the data source uses to obtain connections to the database.- Specified by:
setURLin interfacePoolDataSource- Parameters:
url- URL to be set.- Throws:
SQLException- in case of inability to set URL.
-
setServerName
Sets the database server name.- Specified by:
setServerNamein interfacePoolDataSource- Parameters:
serverName- Database server name to be set.- Throws:
SQLException- in case of inability to set server name.
-
getServerName
Gets the database server name.- Specified by:
getServerNamein interfacePoolDataSource- Returns:
- Database server name.
-
setPortNumber
Sets the database port number.- Specified by:
setPortNumberin interfacePoolDataSource- Parameters:
portNumber- Database port number to be set.- Throws:
SQLException- in case of inability to set port number.
-
getPortNumber
public int getPortNumber()Gets the database port number.- Specified by:
getPortNumberin interfacePoolDataSource- Returns:
- Database port number.
-
setDatabaseName
Sets the database name.- Specified by:
setDatabaseNamein interfacePoolDataSource- Parameters:
databaseName- Database name to be set.- Throws:
SQLException- in case of inability to set db name.
-
getDatabaseName
Gets the database name.- Specified by:
getDatabaseNamein interfacePoolDataSource- Returns:
- Database name.
-
setDataSourceName
Sets the data source name.- Specified by:
setDataSourceNamein interfacePoolDataSource- Parameters:
dataSourceName- data source name to be set.- Throws:
SQLException- in case of inability to set datasource name.
-
getDataSourceName
Gets the data source name.- Specified by:
getDataSourceNamein interfacePoolDataSource- Returns:
- data source name.
-
setDescription
Sets the data source description.- Specified by:
setDescriptionin interfacePoolDataSource- Parameters:
dataSourceDescription- data source description to be set.- Throws:
SQLException- in case of inability to set description.
-
getDescription
Gets the data source description.- Specified by:
getDescriptionin interfacePoolDataSource- Returns:
- data source description.
-
setNetworkProtocol
Sets the datasource networkProtocol.- Specified by:
setNetworkProtocolin interfacePoolDataSource- Parameters:
networkProtocol- datasource networkProtocol to be set.- Throws:
SQLException- in case of inability to set protocol.
-
getNetworkProtocol
Gets the datasource networkProtocol.- Specified by:
getNetworkProtocolin interfacePoolDataSource- Returns:
- datasource networkProtocol.
-
setRoleName
Sets the datasource role name.- Specified by:
setRoleNamein interfacePoolDataSource- Parameters:
roleName- datasource role name to be set.- Throws:
SQLException- in case of inability to set role name.
-
getRoleName
Gets the datasource role name.- Specified by:
getRoleNamein interfacePoolDataSource- Returns:
- datasource role name.
-
setInitialPoolSize
Description copied from interface:PoolDataSourceSets 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:
setInitialPoolSizein interfacePoolDataSource- Parameters:
initialPoolSize- the initial pool size.- Throws:
SQLException- in case of inability to set size.
-
getInitialPoolSize
public int getInitialPoolSize()Description copied from interface:PoolDataSourceGets the initial pool size.- Specified by:
getInitialPoolSizein interfacePoolDataSource- Returns:
- the initial pool size.
-
setMinPoolSize
Description copied from interface:PoolDataSourceSets 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. The default is 1 connection.- Specified by:
setMinPoolSizein interfacePoolDataSource- Parameters:
minPoolSize- The minimum number of connections.- Throws:
SQLException- in case of inability to set min pool size.
-
getMinPoolSize
public int getMinPoolSize()Description copied from interface:PoolDataSourceGets the minimum number of connections that the connection pool will maintain.- Specified by:
getMinPoolSizein interfacePoolDataSource- Returns:
- The minimum number of connections.
-
setMinIdle
Description copied from interface:PoolDataSourceSets the minimum number of idle connections. If the number of available connections IS LESS THAN the minimum then new connections are created and made available in pool.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. The default is 0.- Specified by:
setMinIdlein interfacePoolDataSource- Parameters:
minIdle- The minimum number of idle connections.- Throws:
SQLException- in case of inability to set min idle.
-
getMinIdle
public int getMinIdle()Description copied from interface:PoolDataSourceGets the minimum number of idle connections that the connection pool will maintain.- Specified by:
getMinIdlein interfacePoolDataSource- Returns:
- The minimum number of idle connections.
-
setMaxPoolSize
Description copied from interface:PoolDataSourceSets 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. Default value is Integer.MAX_VALUE.- Specified by:
setMaxPoolSizein interfacePoolDataSource- Parameters:
maxPoolSize- The maximum number of connections.- Throws:
SQLException- in case of inability to set max pool size.
-
getMaxPoolSize
public int getMaxPoolSize()Description copied from interface:PoolDataSourceGets the maximum number of connections that the connection pool will maintain.- Specified by:
getMaxPoolSizein interfacePoolDataSource- Returns:
- The maximum number of connections.
-
getMaxConnectionsPerService
public int getMaxConnectionsPerService()Description copied from interface:PoolDataSourceGets the maximum number of connections that can be obtained to a particular service, in a shared pool.- Specified by:
getMaxConnectionsPerServicein interfacePoolDataSource- Returns:
- The maximum number of connections that can be obtained to a particular service.
-
setInactiveConnectionTimeout
Description copied from interface:PoolDataSourceSets 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.
This property's behaviour is affected by the system property
oracle.ucp.timersAffectAllConnections. For more details go to -PoolDataSource.SYSTEM_PROPERTY_TIMERS_AFFECT_ALL_CONNECTIONS.- Specified by:
setInactiveConnectionTimeoutin interfacePoolDataSource- Parameters:
inactivityTimeout- The inactive connection timeout in seconds.- Throws:
SQLException- in case of inability to set timeout.
-
getInactiveConnectionTimeout
public int getInactiveConnectionTimeout()Description copied from interface:PoolDataSourceGets the inactive connection timeout.- Specified by:
getInactiveConnectionTimeoutin interfacePoolDataSource- Returns:
- The inactivity timeout.
-
setConnectionWaitTimeout
Deprecated.Description copied from interface:PoolDataSourceConfigures how much time a connection request call may wait before it either successfully returns a connection or throws an exception.
The wait duration starts from the point when a connection borrow request is submitted to the pool.
During this time, UCP may either return a connection that's currently available in the pool (ideal scenario) or create a new connection if the pool hasn't reached its maximum size. Otherwise, UCP waits for a connection to be returned to the pool.
By default, the connection wait timeout is set to 3 seconds.
Setting the timeout to 0 makes UCP throw an exception immediately if there is no connection available and no room to grow the pool. Note that it still allows UCP to create a new connection if the maximum size hasn't been reached, and that may take some time.
This method is deprecated. Use
PoolDataSource.setConnectionWaitDuration(java.time.Duration)instead.- Specified by:
setConnectionWaitTimeoutin interfacePoolDataSource- Parameters:
waitTimeout- The amount of time in seconds for a connection request to wait.- Throws:
SQLException- in case it was not possible to set timeout.
-
getConnectionWaitTimeout
Deprecated.Description copied from interface:PoolDataSourceGets the maximum time (in seconds) that any connection borrow request can wait before it returns to the application.
This method is deprecated. Use
PoolDataSource.getConnectionWaitDuration()instead.- Specified by:
getConnectionWaitTimeoutin interfacePoolDataSource- Returns:
- The connection wait timeout.
- See Also:
-
setConnectionWaitDuration
Description copied from interface:PoolDataSourceConfigures how much time a connection request call may wait before it either successfully returns a connection or throws an exception.
The wait duration starts from the point when a connection borrow request is submitted to the pool.
During this time, UCP may either return a connection that's currently available in the pool (ideal scenario) or create a new connection if the pool hasn't reached its maximum size. Otherwise, UCP waits for a connection to be returned to the pool.
By default, the connection wait timeout is set to 3 seconds.
Setting the connection wait timeout to
Duration.ZEROmakes UCP throw an exception immediately if there is no connection available and no room to grow the pool. Note that it still allows UCP to create a new connection if the maximum size hasn't been reached, and that may take some time.- Specified by:
setConnectionWaitDurationin interfacePoolDataSource- Parameters:
duration- The duration for a connection request to wait.- Throws:
SQLException- in case it was not possible to set timeout.
-
getConnectionWaitDuration
Description copied from interface:PoolDataSourceGets the maximum time (in seconds) that any connection borrow request can wait before it returns to the application.
- Specified by:
getConnectionWaitDurationin interfacePoolDataSource- Returns:
- The connection wait duration.
- See Also:
-
setConnectionWaitDurationInMillis
- Throws:
SQLException
-
getConnectionWaitDurationInMillis
public long getConnectionWaitDurationInMillis() -
setTimeToLiveConnectionTimeout
Description copied from interface:PoolDataSourceSets 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:
setTimeToLiveConnectionTimeoutin interfacePoolDataSource- Parameters:
timeToLiveConnectionTimeout- The maximum time (in seconds) a used connection may be active.- Throws:
SQLException- in case of inability to set timeout.
-
getTimeToLiveConnectionTimeout
public int getTimeToLiveConnectionTimeout()Description copied from interface:PoolDataSourceGets 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:
getTimeToLiveConnectionTimeoutin interfacePoolDataSource- Returns:
- The maximum time (in seconds) a used connection may be active.
-
getAbandonedConnectionTimeout
public int getAbandonedConnectionTimeout()Description copied from interface:PoolDataSourceGets the abandoned connection timeout value.- Specified by:
getAbandonedConnectionTimeoutin interfacePoolDataSource- Returns:
- The abandoned connection timeout.
-
setAbandonedConnectionTimeout
Description copied from interface:PoolDataSourceSets 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:
setAbandonedConnectionTimeoutin interfacePoolDataSource- Parameters:
abandonedConnectionTimeout- The value of how long a connection has not been used before it is abandoned (in seconds).- Throws:
SQLException- in case of inability to set timeout.
-
setTimeoutCheckInterval
Description copied from interface:PoolDataSourceSets 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:
setTimeoutCheckIntervalin interfacePoolDataSource- Parameters:
timeInterval- The timeInterval (in seconds) between checks to enforce the timeout properties.- Throws:
SQLException- in case of inability to set interval.
-
getTimeoutCheckInterval
public int getTimeoutCheckInterval()Description copied from interface:PoolDataSourceGets the timeout check interval (in seconds).- Specified by:
getTimeoutCheckIntervalin interfacePoolDataSource- Returns:
- timeInterval The
timeInterval(in seconds) between checks to enforce the timeout properties.
-
setFastConnectionFailoverEnabled
Description copied from interface:PoolDataSourceEnables Fast Connection Failover (FCF) for the connection pool accessed using this pool-enabled data source. By default, FCF is disabled.- Specified by:
setFastConnectionFailoverEnabledin interfacePoolDataSource- Parameters:
failoverEnabled-trueif Fast Connection Failover is enabled;falseif not.- Throws:
SQLException- in case of inability to set flag.
-
getFastConnectionFailoverEnabled
public boolean getFastConnectionFailoverEnabled()Description copied from interface:PoolDataSourceChecks if Fast Connection Failover is enabled.- Specified by:
getFastConnectionFailoverEnabledin interfacePoolDataSource- Returns:
trueif Fast Connection Failover is enabled;falseif not.
-
getConnectionFactoryClassName
Description copied from interface:PoolDataSourceGets the Connection Factory class name.- Specified by:
getConnectionFactoryClassNamein interfacePoolDataSource- Returns:
- Name of the connection factory class specified.
-
setConnectionFactoryClassName
Description copied from interface:PoolDataSourceSets the Connection Factory class name. This is the connection factory used by the connection pool to create physical connections. Must be set forPoolDataSourceto operate.- Specified by:
setConnectionFactoryClassNamein interfacePoolDataSource- Parameters:
factoryClassName- Connection factory class name for obtaining physical connections.- Throws:
SQLException- in case of inability to set factory class name.
-
setMaxStatements
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:
setMaxStatementsin interfacePoolDataSource- Parameters:
maxStatements- maximum number of statements to be pooled.- Throws:
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:
getMaxStatementsin interfacePoolDataSource- Returns:
- The maximum number of statements that may be pooled or cached on a Connection.
-
setMaxIdleTime
Sets Idle timeout for available connections in the pool.- Specified by:
setMaxIdleTimein interfacePoolDataSource- Parameters:
idleTime- Idle timeout value in seconds.- Throws:
SQLException- in case of inability to set idle time.
-
getMaxIdleTime
public int getMaxIdleTime()Gets Idle timeout value.- Specified by:
getMaxIdleTimein interfacePoolDataSource- Returns:
- Idle timeout.
-
setPropertyCycle
Sets Property cycle in seconds. This is the time interval between checks to enforce connection pool timeout properties.- Specified by:
setPropertyCyclein interfacePoolDataSource- Parameters:
propertyCycle- Time interval in seconds to enforce connection pool timeout properties.- Throws:
SQLException- in case of inability to set property cycle.
-
getPropertyCycle
public int getPropertyCycle()Gets Property cycle in seconds.- Specified by:
getPropertyCyclein interfacePoolDataSource- Returns:
- PropertyCycle value.
-
setConnectionPoolName
Sets the connection pool name. This property allows the user to specify a String value to name a connection pool instance.- Specified by:
setConnectionPoolNamein interfacePoolDataSource- Parameters:
connectionPoolName- Name of connection pool.- Throws:
SQLException- in case of inability to set name.
-
getConnectionPoolName
Gets the connection pool name.- Specified by:
getConnectionPoolNamein interfacePoolDataSource- Returns:
- connectionpoolName.
-
setValidateConnectionOnBorrow
Sets whether or not a connection being borrowed should first be validated.- Specified by:
setValidateConnectionOnBorrowin interfacePoolDataSource- Parameters:
validateConnectionOnBorrow- Whether or not a connection being borrowed should first be validated.- Throws:
SQLException- in case of inability to set flag.- See Also:
-
getValidateConnectionOnBorrow
public boolean getValidateConnectionOnBorrow()Returns whether or not a connection being borrowed should first be validated.- Specified by:
getValidateConnectionOnBorrowin interfacePoolDataSource- Returns:
- Whether or not a connection being borrowed should first be validated.
-
setSQLForValidateConnection
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:
setSQLForValidateConnectionin interfacePoolDataSource- Parameters:
SQLString- The SQL string used for connection validation.- Throws:
SQLException- in case of inability to set SQL string.
-
getSQLForValidateConnection
Gets the Value for SQLForValidateConnection property.- Specified by:
getSQLForValidateConnectionin 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:
getConnectionHarvestTriggerCountin interfacePoolDataSource- Returns:
- The number of available connections at which the connection pool's connection harvesting will occur.
-
setConnectionHarvestTriggerCount
Sets the number of available connections at which the connection pool's connection harvesting will occur.- Specified by:
setConnectionHarvestTriggerCountin interfacePoolDataSource- Parameters:
connectionHarvestTriggerCount- The number of available connections at which the connection pool's connection harvesting will occur.- Throws:
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:
getConnectionHarvestMaxCountin interfacePoolDataSource- Returns:
- The maximum number of connections that may be harvested when the connection harvesting occurs.
-
setConnectionHarvestMaxCount
Sets the maximum number of connections that may be harvested when the connection harvesting occurs.- Specified by:
setConnectionHarvestMaxCountin interfacePoolDataSource- Parameters:
connectionHarvestMaxCount- the maximum number of connections that may be harvested when the connection harvesting occurs.- Throws:
SQLException- in case of inability to set that count.
-
getMaxConnectionReuseTime
public long getMaxConnectionReuseTime()Gets the connection reuse time property.- Specified by:
getMaxConnectionReuseTimein interfacePoolDataSource- Returns:
- connection reuse time (in seconds), 0 value means that the feature is disabled.
-
setMaxConnectionReuseTime
Gets the connection reuse time property.- Specified by:
setMaxConnectionReuseTimein interfacePoolDataSource- Parameters:
maxConnectionReuseTime- reuse time (in seconds), 0 value means that the feature is disabled.- Throws:
SQLException- in case of inability to set reuse time.
-
getMaxConnectionReuseCount
public int getMaxConnectionReuseCount()Gets the connection reuse count property.- Specified by:
getMaxConnectionReuseCountin interfacePoolDataSource- Returns:
- connection reuse count, 0 value means that the feature is disabled.
-
setMaxConnectionReuseCount
Gets the connection reuse count property.- Specified by:
setMaxConnectionReuseCountin interfacePoolDataSource- Parameters:
maxConnectionReuseCount- reuse count, 0 value means that the feature is disabled.- Throws:
SQLException- in case of inability to set reuse time.
-
getAvailableConnectionsCount
public int getAvailableConnectionsCount()Gets the number of available connections in the pool.- Specified by:
getAvailableConnectionsCountin interfacePoolDataSource- Returns:
- AvailableConnectionsCount.
-
getBorrowedConnectionsCount
public int getBorrowedConnectionsCount()Gets the number of borrowed connections from the pool.- Specified by:
getBorrowedConnectionsCountin interfacePoolDataSource- Returns:
- BorrowedConnectionsCount.
-
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:
getONSConfigurationin interfacePoolDataSource- Returns:
- The ONS configuration string used for remote ONS subscription.
-
setONSConfiguration
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:
setONSConfigurationin interfacePoolDataSource- Parameters:
onsConfigStr- The configuration string for remote ONS subscription.
-
registerConnectionLabelingCallback
Registers a ConnectionLabelingCallback with the underlying connection pool.- Specified by:
registerConnectionLabelingCallbackin interfacePoolDataSource- Parameters:
cbk- The ConnectionLabelingCallback object to be registered.- Throws:
SQLException- If there is a callback already registered with the pool.
-
removeConnectionLabelingCallback
Removes the ConnectionLabelingCallback object registered with the underlying connection pool, if any.- Specified by:
removeConnectionLabelingCallbackin interfacePoolDataSource- Throws:
SQLException- If callback removal fails.
-
registerConnectionAffinityCallback
Registers a ConnectionAffinityCallback on the connection pool.- Specified by:
registerConnectionAffinityCallbackin interfacePoolDataSource- Parameters:
cbk- Affinity Callback object that must be registered.- Throws:
SQLException- If callback registration fails.
-
removeConnectionAffinityCallback
Removes the ConnectionAffinityCallback registered on the connection pool.- Specified by:
removeConnectionAffinityCallbackin interfacePoolDataSource- Throws:
SQLException- If callback removal fails.
-
getStatistics
Gets the statistics of the connection pool.- Specified by:
getStatisticsin interfacePoolDataSource- Returns:
- The statistics of the connection pool.
-
getServiceName
Gets the service name set on this data source- Specified by:
getServiceNamein interfacePoolDataSource- Returns:
- service name on this data source
-
getConnectionProperties
Gets the connection properties that are set on this data source. Security sensitive values, like passwords, are omitted from thePropertiesobject returned by this method.- Specified by:
getConnectionPropertiesin interfacePoolDataSource- Returns:
- Connection properties.
-
getConnectionProperty
Gets the specified connection property that is set on this data source. Security sensitive values, like passwords, are not returned by this method.- Specified by:
getConnectionPropertyin interfacePoolDataSource- Parameters:
propertyName- The name of the specified property.- Returns:
- The value of the inquired connection property. Null if the property is not set, or is security sensitive.
-
setConnectionProperty
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.OracleDataSourcein the Oracle JDBC driver.- Specified by:
setConnectionPropertyin 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:
SQLException- If any exception occurred while setting the connection property.- See Also:
-
setConnectionProperties
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.OracleDataSourcein the Oracle JDBC driver.- Specified by:
setConnectionPropertiesin interfacePoolDataSource- Parameters:
connectionProperties- Connection properties to be set on the connection factory class.- Throws:
SQLException- If any exception occurred while setting the connection properties.- See Also:
-
getConnectionFactoryProperties
Gets the connection factory properties that are set on this data source.- Specified by:
getConnectionFactoryPropertiesin interfacePoolDataSource- Returns:
- Connection factory properties.
-
getConnectionFactoryProperty
Gets the specified connection factory property that are set on this data source.- Specified by:
getConnectionFactoryPropertyin 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
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:
setConnectionFactoryPropertyin 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:
SQLException- If any exception occurred while setting the connection factory property.IllegalArgumentException- If the property name or value is invalid.
-
setConnectionFactoryProperties
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:
setConnectionFactoryPropertiesin interfacePoolDataSource- Parameters:
factoryProperties- Connection factory properties to be set on the connection factory class.- Throws:
SQLException- If any exception occurred while setting the connection factory properties.IllegalArgumentException- If factoryProperties is empty.
-
isSetOnceProperty
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
-
getReference
- Specified by:
getReferencein interfaceReferenceable
-
getObjectInstance
public Object getObjectInstance(Object refObj, Name name, Context nameCtx, Hashtable<?, ?> env) throws Exception- Specified by:
getObjectInstancein interfaceObjectFactory- Throws:
Exception
-
isWrapperFor
Since this class is not a wrapper, just check to see if this implements the requested interface.- Specified by:
isWrapperForin interfaceWrapper- Parameters:
iface- Requested interface.- Returns:
- true If this implements the requested interface.
- Throws:
SQLException- If the argument is not an interface.- Since:
- JDBC 4.0
-
unwrap
Since this class is not a wrapper, just check to see if this implements the requested interface.- Specified by:
unwrapin interfaceWrapper- Parameters:
iface- Requested interface.- Returns:
- this If this implements the requested interface.
- Throws:
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 SQLException Registers a connection initialization callback.- Specified by:
registerConnectionInitializationCallbackin interfacePoolDataSource- Parameters:
cbk- TheConnectionInitializationCallbackobject to be registered.- Throws:
SQLException- If there is a callback already registered with the pool.
-
unregisterConnectionInitializationCallback
Unregisters the connection initialization callback on this pool.- Specified by:
unregisterConnectionInitializationCallbackin interfacePoolDataSource- Throws:
SQLException- If callback removal fails.
-
getConnectionInitializationCallback
Obtains the registered connection initialization callback, if any.- Specified by:
getConnectionInitializationCallbackin interfacePoolDataSource- Returns:
- The registered
ConnectionInitializationCallback, or null if there is no callback registered.
-
registerConnectionCreationConsumer
public void registerConnectionCreationConsumer(Consumer<oracle.ucp.ConnectionCreationInformation> consumer) Description copied from interface:PoolDataSourceRegisters a connection creation Consumer.- Specified by:
registerConnectionCreationConsumerin interfacePoolDataSource- Parameters:
consumer- TheConsumerobject to be registered.
-
unregisterConnectionCreationConsumer
public void unregisterConnectionCreationConsumer()Description copied from interface:PoolDataSourceUnregisters the connection creation Consumer on this pool.- Specified by:
unregisterConnectionCreationConsumerin interfacePoolDataSource
-
getConnectionCreationConsumer
Description copied from interface:PoolDataSourceObtains the registered connection creation Consumer, if any.- Specified by:
getConnectionCreationConsumerin interfacePoolDataSource- Returns:
- The registered
Consumer, or null if there is no Consumer registered.
-
getConnectionLabelingHighCost
public int getConnectionLabelingHighCost()Description copied from interface:PoolDataSourceObtains the cost value which identifies a connection as "high-cost" for connection labeling.- Specified by:
getConnectionLabelingHighCostin interfacePoolDataSource- Returns:
- The cost value that identifies a connection as "high-cost" for connection labeling.
- See Also:
-
setConnectionLabelingHighCost
Description copied from interface:PoolDataSourceSets 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:
setConnectionLabelingHighCostin interfacePoolDataSource- Parameters:
highCost- The cost value that identifies a connection as "high-cost" for connection labeling.- Throws:
SQLException- If an exception occurs while setting the cost.
-
getConnectionRepurposeThreshold
public int getConnectionRepurposeThreshold()Description copied from interface:PoolDataSourceGets 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:
getConnectionRepurposeThresholdin interfacePoolDataSource- Returns:
- connection repurpose threshold property value currently set.
-
setConnectionRepurposeThreshold
Description copied from interface:PoolDataSourceSets the connection repurpose threshold for the pool. This property is applicable only for multi-tenant databases.- Specified by:
setConnectionRepurposeThresholdin interfacePoolDataSource- Parameters:
threshold- connection repurpose threshold to set.- Throws:
SQLException- If any exception occurs while setting the threshold.- See Also:
-
getHighCostConnectionReuseThreshold
public int getHighCostConnectionReuseThreshold()Description copied from interface:PoolDataSourceObtains the high-cost connection reuse threshold property value for connection labeling.- Specified by:
getHighCostConnectionReuseThresholdin interfacePoolDataSource- Returns:
- The high-cost connection reuse threshold property value currently set.
- See Also:
-
setHighCostConnectionReuseThreshold
Description copied from interface:PoolDataSourceSets 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:
setHighCostConnectionReuseThresholdin interfacePoolDataSource- Parameters:
threshold- The high-cost connection reuse threshold to set.- Throws:
SQLException- If any exception occurs while setting the threshold.
-
getPdbRoles
Gets the PDB roles specified for this datasource- Specified by:
getPdbRolesin 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:
getSecondsToTrustIdleConnectionin interfacePoolDataSource- Returns:
- Seconds To Trust Idle Connection value.
-
setSecondsToTrustIdleConnection
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 120 seconds which means that the feature is enabled.- Specified by:
setSecondsToTrustIdleConnectionin interfacePoolDataSource- Parameters:
secondsToTrustIdleConnection- The value of how long a connection can be trusted to skip connectionValidationOnBorrow- Throws:
SQLException- in case of inability to set these seconds.
-
createConnectionBuilder
Description copied from interface:PoolDataSourceCreates a new UCPConnectionBuilder instance.- Specified by:
createConnectionBuilderin interfaceDataSource- Specified by:
createConnectionBuilderin interfacePoolDataSource- Returns:
- Connection builder that builds OracleConnection
- See Also:
-
getParentLogger
- Specified by:
getParentLoggerin interfaceCommonDataSource- Returns:
- null
- See Also:
-
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:
getQueryTimeoutin interfacePoolDataSource- Returns:
- The query timeout in seconds
-
setQueryTimeout
Sets the number of seconds the driver will wait for a Statement object to execute to the given number of seconds.- Specified by:
setQueryTimeoutin interfacePoolDataSource- Parameters:
queryTimeout- in seconds- Throws:
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:
getMaxConnectionsPerShardin interfacePoolDataSource- Returns:
- The configured max number of connections that can be created per shard.
-
setMaxConnectionsPerShard
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:
setMaxConnectionsPerShardin interfacePoolDataSource- Parameters:
maxConnectionsPerShard- The max number of connections that can be created per shard- Throws:
SQLException- if there is an any exception while setting this parameter
-
setShardingMode
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:
setShardingModein interfacePoolDataSource- Parameters:
shardingMode- Mode of UCP when using a Sharded Database.- Throws:
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:
getShardingModein interfacePoolDataSource- Returns:
- Mode of UCP when using a Sharded Database.
-
setConnectionValidationTimeout
Description copied from interface:PoolDataSourceThis 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:
setConnectionValidationTimeoutin interfacePoolDataSource- Parameters:
connectionValidationTimeout- timeout to validate connection- Throws:
SQLException- if tiomeout is negative- See Also:
-
getConnectionValidationTimeout
public int getConnectionValidationTimeout()Description copied from interface:PoolDataSourceConnection validation timeout getter- Specified by:
getConnectionValidationTimeoutin interfacePoolDataSource- Returns:
- the current connection validation timaout value in seconds
- See Also:
-
setSSLContext
Description copied from interface:PoolDataSourceSpecifies aSSLContextto 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:
setSSLContextin interfacePoolDataSource- Parameters:
sslContext- SSLContext instance to be used as an SSLEngine factory.- See Also:
-
getSSLContext
Returns SSL context associated with the datasource.- Returns:
- SSL context
-
setHostnameResolver
Description copied from interface:PoolDataSourceSpecifies aPoolDataSource.HostnameResolverto use by the pool- Specified by:
setHostnameResolverin interfacePoolDataSource- Parameters:
hostnameResolver- HostnameResolver instance to be used as a custom DNS name resolver.- See Also:
-
getHostnameResolver
Returns the hostname resolver associated with this datasource- Returns:
- Hostname Resolver
-
isReadOnlyInstanceAllowed
public boolean isReadOnlyInstanceAllowed()Description copied from interface:PoolDataSourceReturns 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:
isReadOnlyInstanceAllowedin interfacePoolDataSource- Returns:
- true if the connection borrow is allowed to a read-only instance, false otherwise.
- See Also:
-
setReadOnlyInstanceAllowed
Description copied from interface:PoolDataSourceSets 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:
setReadOnlyInstanceAllowedin interfacePoolDataSource- Parameters:
readOnlyInstanceAllowed- whether to allow connection borrow to a read-only instance or not- Throws:
SQLException- if unable to set property value- See Also:
-
setTokenSupplier
public final void setTokenSupplier(Supplier<? extends oracle.jdbc.AccessToken> tokenSupplier) throws SQLException Sets a supplier function that generates an access token when creating a connection with this
DataSource. The supplier function is invoked each time thisDataSourcecreates a connection. Instances ofAccessTokenthat 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
DataSourcewith 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 thisDataSourcewith a user name or password, and an invocation of this method has also configured a token supplier, then aSQLExceptionindicating an invalid configuration is thrown when creating a connection with this datasource.Note that
AccessToken.createJsonWebTokenCache(Supplier)can be called to create a thread safeSupplierthat caches tokens from a user definedSupplier.- Specified by:
setTokenSupplierin interfacePoolDataSource- Parameters:
tokenSupplier- Token supplying function. Notnull.- Throws:
NullPointerException- If thetokenSupplieris null.SQLException- if unable to set property value
-
getDiagnosable
Related diagnosable object- Specified by:
getDiagnosablein interfaceDiagnosable- Returns:
- diagnosable object for a pool data source
-
isCreateConnectionInBorrowThread
public boolean isCreateConnectionInBorrowThread()Description copied from interface:PoolDataSourceReturns the connection creation mode: either "true" if connections are created using the borrowing thread, or "false" if connections are created in the background (the default).- Specified by:
isCreateConnectionInBorrowThreadin interfacePoolDataSource- Returns:
- true, if creating connections in a borrow thread, false otherwise.
- See Also:
-
setCreateConnectionInBorrowThread
public void setCreateConnectionInBorrowThread(boolean createConnectionInBorrowThread) throws SQLException Description copied from interface:PoolDataSourceSet this flag to true to make UCP use the borrowing thread to create new connections. By default, connections are created in the background. The only reason why you may want to set this to "true" is to make a connection request fail-fast if the driver throws an exception while connecting; otherwise, the background task will keep trying until the connection wait timeout expires.
If this property is set to false, a pool waits no longer than a designated connection wait duration no matter how long it takes to create a new connection to grow a pool, if no connection is available at this moment. If this property is set to true, then in this backward compatibility mode a pool waits for a connection to be synchronously created in a borrow thread, and the waiting time can take longer than connectionWaitDuration. For connectionWaitDuration please refer to
PoolDataSource.setConnectionWaitDuration(java.time.Duration).- Specified by:
setCreateConnectionInBorrowThreadin interfacePoolDataSource- Parameters:
createConnectionInBorrowThread- if true, create connections in a borrow thread.- Throws:
SQLException- if unable to set property value.
-
isCommitOnConnectionReturn
public boolean isCommitOnConnectionReturn()Description copied from interface:PoolDataSourceReturns the boolean value for the property that controls the behavior of UCP when a connection is released back to the pool with pending uncommitted changes in an active transaction. By default, UCP will commit the changes (default value is "true"). When setting this property to "false" the changes will be rolled back.- Specified by:
isCommitOnConnectionReturnin interfacePoolDataSource- Returns:
- true to commit, false to rollback.
-
setCommitOnConnectionReturn
Description copied from interface:PoolDataSourceSets the boolean value for the property that controls the behavior of UCP when a connection is released back to the pool with pending uncommitted changes in an active transaction. By default, UCP will commit the changes (default value is "true"). When setting this property to "false" the changes will be rolled back.- Specified by:
setCommitOnConnectionReturnin interfacePoolDataSource- Parameters:
commit- 'true' to commit, 'false' to rollback. The default is 'true'.- Throws:
SQLException
-