Skip navigation links

Oracle® Universal Connection Pool for JDBC Java API Reference
12c Release 1 (12.1)

E17662-07


oracle.ucp.jdbc
Interface PoolDataSource

All Superinterfaces:
javax.sql.CommonDataSource, javax.sql.DataSource, java.sql.Wrapper
All Known Subinterfaces:
PoolXADataSource
All Known Implementing Classes:
PoolDataSourceImpl, PoolXADataSourceImpl

public interface PoolDataSource
extends javax.sql.DataSource

A connection pool-aware data source interface. PoolDataSource uses Universal Connection Pool internally. See setters for pool properties and their default values.

See Also:
UniversalConnectionPool

Field Summary
static java.lang.String UCP_ABANDONED_CONNECTION_TIMEOUT
           
static java.lang.String UCP_CONNECTION_FACTORY_CLASS_NAME
           
static java.lang.String UCP_CONNECTION_FACTORY_PROPERTIES
           
static java.lang.String UCP_CONNECTION_HARVEST_MAX_COUNT
           
static java.lang.String UCP_CONNECTION_HARVEST_TRIGGER_COUNT
           
static java.lang.String UCP_CONNECTION_POOL_NAME
           
static java.lang.String UCP_CONNECTION_PROPERTIES
           
static java.lang.String UCP_CONNECTION_WAIT_TIMEOUT
           
static java.lang.String UCP_DATA_SOURCE_NAME
           
static java.lang.String UCP_DATABASE_NAME
           
static java.lang.String UCP_DESCRIPTION
           
static java.lang.String UCP_FAST_CONNECTION_FAILOVER_ENABLED
           
static java.lang.String UCP_INACTIVE_CONNECTION_TIMEOUT
           
static java.lang.String UCP_INITIAL_POOL_SIZE
           
static java.lang.String UCP_MAX_CONNECTION_REUSE_COUNT
           
static java.lang.String UCP_MAX_CONNECTION_REUSE_TIME
           
static java.lang.String UCP_MAX_IDLE_TIME
           
static java.lang.String UCP_MAX_POOL_SIZE
           
static java.lang.String UCP_MAX_STATEMENTS
           
static java.lang.String UCP_MIN_POOL_SIZE
           
static java.lang.String UCP_NETWORK_PROTOCOL
           
static java.lang.String UCP_NTH_RETURNED_CONNECTION_TO_VALIDATE
           
static java.lang.String UCP_ONS_CONFIGURATION
           
static java.lang.String UCP_PASSWORD
           
static java.lang.String UCP_PORT_NUMBER
           
static java.lang.String UCP_PROPERTY_CYCLE
           
static java.lang.String UCP_ROLE_NAME
           
static java.lang.String UCP_SERVER_NAME
           
static java.lang.String UCP_SQL_FOR_VALIDATE_CONNECTION
           
static java.lang.String UCP_TIME_TO_LIVE_CONNECTION_TIMEOUT
           
static java.lang.String UCP_TIMEOUT_CHECK_INTERVAL
           
static java.lang.String UCP_URL
           
static java.lang.String UCP_USER
           
static java.lang.String UCP_VALIDATE_CONNECTION_ON_BORROW
           

 

Method Summary
 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(java.util.Properties labels)
          Attempts to obtain a database connection with the requested connection labels.
 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.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 below which the connection pool's connection harvesting will occur.
 ConnectionInitializationCallback getConnectionInitializationCallback()
          Obtains the registered connection initialization callback, if any.
 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 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 getInactiveConnectionTimeout()
          Gets the inactive connection timeout.
 int getInitialPoolSize()
          Gets the initial pool size.
 int getMaxConnectionReuseCount()
          Gets the maximum connection reuse count property value.
 long getMaxConnectionReuseTime()
          Gets the maximum connection reuse time property value.
 int getMaxIdleTime()
          Gets the maximum idle time.
 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 data source network protocol.
 java.lang.String getONSConfiguration()
          Returns the ONS configuration string that is used for remote ONS subscription in the form specified in setONSConfiguration(String).
 java.lang.String getPassword()
          Gets the Password for this data source.
 int getPortNumber()
          Gets the database port number.
 int getPropertyCycle()
          Gets the property cycle in seconds.
 java.lang.String getRoleName()
          Gets the data source role name.
 java.lang.String getServerName()
          Gets the database server name.
 java.lang.String getSQLForValidateConnection()
          Gets the value of the SQLForValidateConnection property.
 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.
 void registerConnectionAffinityCallback(ConnectionAffinityCallback cbk)
          Registers a connection affinity callback on the connection pool.
 void registerConnectionInitializationCallback(ConnectionInitializationCallback cbk)
          Registers a connection initialization callback.
 void registerConnectionLabelingCallback(ConnectionLabelingCallback cbk)
          Registers a connection labeling callback with the underlying connection pool.
 void removeConnectionAffinityCallback()
          Removes the ConnectionAffinityCallback object 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 below which the connection pool's connection harvesting will occur.
 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 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 description)
          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 setInactiveConnectionTimeout(int inactivityTimeout)
          Sets the inactive connection timeout.
 void setInitialPoolSize(int initialPoolSize)
          Sets the initial pool size.
 void setMaxConnectionReuseCount(int maxConnectionReuseCount)
          Sets the maximum connection reuse count property.
 void setMaxConnectionReuseTime(long maxConnectionReuseTime)
          Sets the maximum connection reuse time property.
 void setMaxIdleTime(int idleTime)
          Sets the maximum idle time 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 data source network protocol.
 void setONSConfiguration(java.lang.String onsConfigStr)
          Sets the configuration string used for remote ONS subscription.
 void setPassword(java.lang.String pd)
          Sets the password with which connections have to be obtained.
 void setPortNumber(int portNumber)
          Sets the database port number.
 void setPropertyCycle(int propertyCycle)
          Sets the property cycle in seconds.
 void setRoleName(java.lang.String roleName)
          Sets the data source role name.
 void setServerName(java.lang.String serverName)
          Sets the database server name.
 void setSQLForValidateConnection(java.lang.String SQLString)
          Sets the value of the SQLForValidateConnection property.
 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 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 unregisterConnectionInitializationCallback()
          Unregisters the connection initialization callback on this pool.

 

Methods inherited from interface javax.sql.DataSource
getConnection, getConnection

 

Methods inherited from interface javax.sql.CommonDataSource
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter

 

Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap

 

Field Detail

UCP_USER

static final java.lang.String UCP_USER
See Also:
Constant Field Values

UCP_URL

static final java.lang.String UCP_URL
See Also:
Constant Field Values

UCP_PASSWORD

static final java.lang.String UCP_PASSWORD
See Also:
Constant Field Values

UCP_SERVER_NAME

static final java.lang.String UCP_SERVER_NAME
See Also:
Constant Field Values

UCP_PORT_NUMBER

static final java.lang.String UCP_PORT_NUMBER
See Also:
Constant Field Values

UCP_DATABASE_NAME

static final java.lang.String UCP_DATABASE_NAME
See Also:
Constant Field Values

UCP_DATA_SOURCE_NAME

static final java.lang.String UCP_DATA_SOURCE_NAME
See Also:
Constant Field Values

UCP_DESCRIPTION

static final java.lang.String UCP_DESCRIPTION
See Also:
Constant Field Values

UCP_NETWORK_PROTOCOL

static final java.lang.String UCP_NETWORK_PROTOCOL
See Also:
Constant Field Values

UCP_ROLE_NAME

static final java.lang.String UCP_ROLE_NAME
See Also:
Constant Field Values

UCP_CONNECTION_FACTORY_CLASS_NAME

static final java.lang.String UCP_CONNECTION_FACTORY_CLASS_NAME
See Also:
Constant Field Values

UCP_CONNECTION_PROPERTIES

static final java.lang.String UCP_CONNECTION_PROPERTIES
See Also:
Constant Field Values

UCP_CONNECTION_FACTORY_PROPERTIES

static final java.lang.String UCP_CONNECTION_FACTORY_PROPERTIES
See Also:
Constant Field Values

UCP_VALIDATE_CONNECTION_ON_BORROW

static final java.lang.String UCP_VALIDATE_CONNECTION_ON_BORROW
See Also:
Constant Field Values

UCP_SQL_FOR_VALIDATE_CONNECTION

static final java.lang.String UCP_SQL_FOR_VALIDATE_CONNECTION
See Also:
Constant Field Values

UCP_CONNECTION_POOL_NAME

static final java.lang.String UCP_CONNECTION_POOL_NAME
See Also:
Constant Field Values

UCP_INITIAL_POOL_SIZE

static final java.lang.String UCP_INITIAL_POOL_SIZE
See Also:
Constant Field Values

UCP_MIN_POOL_SIZE

static final java.lang.String UCP_MIN_POOL_SIZE
See Also:
Constant Field Values

UCP_MAX_POOL_SIZE

static final java.lang.String UCP_MAX_POOL_SIZE
See Also:
Constant Field Values

UCP_NTH_RETURNED_CONNECTION_TO_VALIDATE

static final java.lang.String UCP_NTH_RETURNED_CONNECTION_TO_VALIDATE
See Also:
Constant Field Values

UCP_ABANDONED_CONNECTION_TIMEOUT

static final java.lang.String UCP_ABANDONED_CONNECTION_TIMEOUT
See Also:
Constant Field Values

UCP_TIME_TO_LIVE_CONNECTION_TIMEOUT

static final java.lang.String UCP_TIME_TO_LIVE_CONNECTION_TIMEOUT
See Also:
Constant Field Values

UCP_INACTIVE_CONNECTION_TIMEOUT

static final java.lang.String UCP_INACTIVE_CONNECTION_TIMEOUT
See Also:
Constant Field Values

UCP_MAX_IDLE_TIME

static final java.lang.String UCP_MAX_IDLE_TIME
See Also:
Constant Field Values

UCP_TIMEOUT_CHECK_INTERVAL

static final java.lang.String UCP_TIMEOUT_CHECK_INTERVAL
See Also:
Constant Field Values

UCP_PROPERTY_CYCLE

static final java.lang.String UCP_PROPERTY_CYCLE
See Also:
Constant Field Values

UCP_MAX_STATEMENTS

static final java.lang.String UCP_MAX_STATEMENTS
See Also:
Constant Field Values

UCP_CONNECTION_WAIT_TIMEOUT

static final java.lang.String UCP_CONNECTION_WAIT_TIMEOUT
See Also:
Constant Field Values

UCP_MAX_CONNECTION_REUSE_TIME

static final java.lang.String UCP_MAX_CONNECTION_REUSE_TIME
See Also:
Constant Field Values

UCP_MAX_CONNECTION_REUSE_COUNT

static final java.lang.String UCP_MAX_CONNECTION_REUSE_COUNT
See Also:
Constant Field Values

UCP_CONNECTION_HARVEST_TRIGGER_COUNT

static final java.lang.String UCP_CONNECTION_HARVEST_TRIGGER_COUNT
See Also:
Constant Field Values

UCP_CONNECTION_HARVEST_MAX_COUNT

static final java.lang.String UCP_CONNECTION_HARVEST_MAX_COUNT
See Also:
Constant Field Values

UCP_FAST_CONNECTION_FAILOVER_ENABLED

static final java.lang.String UCP_FAST_CONNECTION_FAILOVER_ENABLED
See Also:
Constant Field Values

UCP_ONS_CONFIGURATION

static final java.lang.String UCP_ONS_CONFIGURATION
See Also:
Constant Field Values

Method Detail

getInitialPoolSize

int getInitialPoolSize()
Gets the initial pool size.
Returns:
the initial pool size.

setInitialPoolSize

void setInitialPoolSize(int initialPoolSize)
                        throws java.sql.SQLException
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.

Parameters:
initialPoolSize - the initial pool size.
Throws:
java.sql.SQLException

getMinPoolSize

int getMinPoolSize()
Gets the minimum number of connections that the connection pool will maintain.
Returns:
The minimum number of connections.

setMinPoolSize

void setMinPoolSize(int minPoolSize)
                    throws java.sql.SQLException
Sets the minimum number of connections. If the number of available connections + the number of connections in use < 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.

Parameters:
minPoolSize - The minimum number of connections.
Throws:
java.sql.SQLException

getMaxPoolSize

int getMaxPoolSize()
Gets the maximum number of connections that the connection pool will maintain.
Returns:
The maximum number of connections.

setMaxPoolSize

void setMaxPoolSize(int maxPoolSize)
                    throws java.sql.SQLException
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 to Integer.MAX_VALUE.

Parameters:
maxPoolSize - The maximum number of connections.
Throws:
java.sql.SQLException

getInactiveConnectionTimeout

int getInactiveConnectionTimeout()
Gets the inactive connection timeout.
Returns:
The inactivity timeout.

setInactiveConnectionTimeout

void setInactiveConnectionTimeout(int inactivityTimeout)
                                  throws java.sql.SQLException
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.

Parameters:
inactivityTimeout - The inactive connection timeout in seconds.
Throws:
java.sql.SQLException

getAbandonedConnectionTimeout

int getAbandonedConnectionTimeout()
Gets the abandoned connection timeout value.
Returns:
The abandoned connection timeout.

setAbandonedConnectionTimeout

void setAbandonedConnectionTimeout(int abandonedConnectionTimeout)
                                   throws java.sql.SQLException
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.

Parameters:
abandonedConnectionTimeout - The value of how long a connection has not been used before it is abandoned (in seconds).
Throws:
java.sql.SQLException

getConnectionWaitTimeout

int getConnectionWaitTimeout()
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.
Returns:
The connection wait timeout.

setConnectionWaitTimeout

void setConnectionWaitTimeout(int waitTimeout)
                              throws java.sql.SQLException
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.

Parameters:
waitTimeout - The amount of time to wait.
Throws:
java.sql.SQLException

getTimeToLiveConnectionTimeout

int getTimeToLiveConnectionTimeout()
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.
Returns:
The maximum time (in seconds) a used connection may be active.

setTimeToLiveConnectionTimeout

void setTimeToLiveConnectionTimeout(int timeToLiveConnectionTimeout)
                                    throws java.sql.SQLException
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.

Parameters:
timeToLiveConnectionTimeout - The maximum time (in seconds) a used connection may be active.
Throws:
java.sql.SQLException

setTimeoutCheckInterval

void setTimeoutCheckInterval(int timeInterval)
                             throws java.sql.SQLException
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.

Parameters:
timeInterval - The timeInterval (in seconds) between checks to enforce the timeout properties.
Throws:
java.sql.SQLException

getTimeoutCheckInterval

int getTimeoutCheckInterval()
Gets the timeout check interval (in seconds).
Returns:
timeInterval The timeInterval (in seconds) between checks to enforce the timeout properties.

setFastConnectionFailoverEnabled

void setFastConnectionFailoverEnabled(boolean failoverEnabled)
                                      throws java.sql.SQLException
Enables Fast Connection Failover (FCF) for the connection pool accessed using this pool-enabled data source. By default, FCF is disabled.
Parameters:
failoverEnabled - true if Fast Connection Failover is enabled; false if not.
Throws:
java.sql.SQLException

getFastConnectionFailoverEnabled

boolean getFastConnectionFailoverEnabled()
Checks if Fast Connection Failover is enabled.
Returns:
true if Fast Connection Failover is enabled; false if not.

getConnectionFactoryClassName

java.lang.String getConnectionFactoryClassName()
Gets the Connection Factory class name.
Returns:
Name of the connection factory class specified.

setConnectionFactoryClassName

void setConnectionFactoryClassName(java.lang.String factoryClassName)
                                   throws java.sql.SQLException
Sets the Connection Factory class name. This is the connection factory used by the connection pool to create physical connections. Must be set for PoolDataSource to operate.
Parameters:
factoryClassName - Connection factory class name for obtaining physical connections.
Throws:
java.sql.SQLException

setMaxStatements

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.

The range of valid values is 0 to Integer.MAX_VALUE. Defaults to 0.

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

int getMaxStatements()
Gets the maximum number of statements that may be pooled or cached on a Connection.
Returns:
m_maxStatements maximum number of statements that may be pooled or cached on a Connection.

setMaxIdleTime

void setMaxIdleTime(int idleTime)
                    throws java.sql.SQLException
Sets the maximum idle time for available connections in the pool. This has the same effect as setting the inactive connection timeout.

The range of valid values is 0 to Integer.MAX_VALUE. Defaults to 0.

Parameters:
idleTime - Maximum idle time in seconds.
Throws:
java.sql.SQLException

getMaxIdleTime

int getMaxIdleTime()
Gets the maximum idle time.
Returns:
The maximum idle time.

setPropertyCycle

void setPropertyCycle(int propertyCycle)
                      throws java.sql.SQLException
Sets the property cycle in seconds. This is the time interval between checks to enforce connection pool timeout properties. This has the same effect as setting timeoutCheckInterval.

The range of valid values is 0 to Integer.MAX_VALUE. Defaults to 30.

Parameters:
propertyCycle - Time interval in seconds to enforce connection pool timeout properties.
Throws:
java.sql.SQLException

getPropertyCycle

int getPropertyCycle()
Gets the property cycle in seconds.
Returns:
The PropertyCycle value.

setConnectionPoolName

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.

If not set, the pool name will be automatically generated.

Parameters:
connectionpoolName - Name of the connection pool.
Throws:
java.sql.SQLException

getConnectionPoolName

java.lang.String getConnectionPoolName()
Gets the connection pool name.
Returns:
The connection pool name.

setURL

void setURL(java.lang.String url)
            throws java.sql.SQLException
Sets the URL that the data source uses to obtain connections to the database.
Parameters:
url - URL to be set.
Throws:
java.sql.SQLException

getURL

java.lang.String getURL()
Gets the URL for this data source.
Returns:
URL for this data source.

setUser

void setUser(java.lang.String userName)
             throws java.sql.SQLException
Sets the user name with which connections have to be obtained.
Parameters:
userName - Username to be set.
Throws:
java.sql.SQLException

getUser

java.lang.String getUser()
Gets the user name for this data source.
Returns:
userName for this data source.

setPassword

void setPassword(java.lang.String pd)
                 throws java.sql.SQLException
Sets the password with which connections have to be obtained.
Parameters:
pd - Password to be set.
Throws:
java.sql.SQLException

getPassword

java.lang.String getPassword()
Gets the Password for this data source.
Returns:
password for this data source.

setServerName

void setServerName(java.lang.String serverName)
                   throws java.sql.SQLException
Sets the database server name.
Parameters:
serverName - Database server name to be set.
Throws:
java.sql.SQLException

getServerName

java.lang.String getServerName()
Gets the database server name.
Returns:
Database server name.

setPortNumber

void setPortNumber(int portNumber)
                   throws java.sql.SQLException
Sets the database port number.
Parameters:
portNumber - Database port number to be set.
Throws:
java.sql.SQLException

getPortNumber

int getPortNumber()
Gets the database port number.
Returns:
Database port number.

setDatabaseName

void setDatabaseName(java.lang.String databaseName)
                     throws java.sql.SQLException
Sets the database name.
Parameters:
databaseName - Database name to be set.
Throws:
java.sql.SQLException

getDatabaseName

java.lang.String getDatabaseName()
Gets the database name.
Returns:
Database name.

setDataSourceName

void setDataSourceName(java.lang.String dataSourceName)
                       throws java.sql.SQLException
Sets the data source name.
Parameters:
dataSourceName - data source name to be set.
Throws:
java.sql.SQLException

getDataSourceName

java.lang.String getDataSourceName()
Gets the data source name.
Returns:
data source name.

setDescription

void setDescription(java.lang.String description)
                    throws java.sql.SQLException
Sets the data source description.
Parameters:
description - data source description to be set.
Throws:
java.sql.SQLException

getDescription

java.lang.String getDescription()
Gets the data source description.
Returns:
data source description.

setNetworkProtocol

void setNetworkProtocol(java.lang.String networkProtocol)
                        throws java.sql.SQLException
Sets the data source network protocol.
Parameters:
networkProtocol - data source network protocol to be set.
Throws:
java.sql.SQLException

getNetworkProtocol

java.lang.String getNetworkProtocol()
Gets the data source network protocol.
Returns:
data source network protocol.

setRoleName

void setRoleName(java.lang.String roleName)
                 throws java.sql.SQLException
Sets the data source role name.
Parameters:
roleName - data source role name to be set.
Throws:
java.sql.SQLException

getRoleName

java.lang.String getRoleName()
Gets the data source role name.
Returns:
data source role name.

setValidateConnectionOnBorrow

void setValidateConnectionOnBorrow(boolean validateConnectionOnBorrow)
                                   throws java.sql.SQLException
Sets whether or not a connection being borrowed should first be validated. Defaults to false.
Parameters:
validateConnectionOnBorrow - Whether or not a connection being borrowed should first be validated.
Throws:
java.sql.SQLException

getValidateConnectionOnBorrow

boolean getValidateConnectionOnBorrow()
Returns whether or not a connection being borrowed should first be validated.
Returns:
Whether or not a connection being borrowed should first be validated.

setSQLForValidateConnection

void setSQLForValidateConnection(java.lang.String SQLString)
                                 throws java.sql.SQLException
Sets the value of the SQLForValidateConnection property. This is a SQL command used in conjunction with the ValidateConnectionOnBorrow property. The SQL specified should be applicable to the backend database and the JDBC driver configured. Defaults to null.
Parameters:
SQLString - The SQL string used for connection validation.
Throws:
java.sql.SQLException

getSQLForValidateConnection

java.lang.String getSQLForValidateConnection()
Gets the value of the SQLForValidateConnection property.
Returns:
The SQLForValidateConnection property value.

getConnectionHarvestTriggerCount

int getConnectionHarvestTriggerCount()
Gets the number of available connections below which the connection pool's connection harvesting will occur. For example, if the value is set to 10, then connection harvesting will occur when the number of available connections drops to 10.
Returns:
The number of available connections below which the connection pool's connection harvesting will occur.

setConnectionHarvestTriggerCount

void setConnectionHarvestTriggerCount(int connectionHarvestTriggerCount)
                                      throws java.sql.SQLException
Sets the number of available connections below which the connection pool's connection harvesting will occur.

The range of valid values is 0 to maxPoolSize. Defaults to Integer.MAX_VALUE.

Setting the value to Integer.MAX_VALUE disables connection harvesting.

Parameters:
connectionHarvestTriggerCount - The number of available connections below which the connection pool's connection harvesting will occur.
Throws:
java.sql.SQLException

getConnectionHarvestMaxCount

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.
Returns:
The maximum number of connections that may be harvested when the connection harvesting occurs.

setConnectionHarvestMaxCount

void setConnectionHarvestMaxCount(int connectionHarvestMaxCount)
                                  throws java.sql.SQLException
Sets the maximum number of connections that may be harvested when the connection harvesting occurs.

The range of valid values is 1 to maxPoolSize. Defaults to 1.

Parameters:
connectionHarvestMaxCount - the maximum number of connections that may be harvested when the connection harvesting occurs.
Throws:
java.sql.SQLException

getAvailableConnectionsCount

int getAvailableConnectionsCount()
                                 throws java.sql.SQLException
Gets the number of available connections in the pool.
Returns:
AvailableConnectionsCount
Throws:
java.sql.SQLException

getBorrowedConnectionsCount

int getBorrowedConnectionsCount()
                                throws java.sql.SQLException
Gets the number of borrowed connections from the pool.
Returns:
BorrowedConnectionsCount
Throws:
java.sql.SQLException

getONSConfiguration

java.lang.String getONSConfiguration()
                                     throws java.sql.SQLException
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 Connection Load Balancing.
Returns:
The ONS configuration string used for remote ONS subscription.
Throws:
java.sql.SQLException

setONSConfiguration

void setONSConfiguration(java.lang.String onsConfigStr)
                         throws java.sql.SQLException
Sets the configuration string used for remote ONS subscription. The parameter string closely resembles the content of the ONS configuration file (ons.config). The string contains a list of name=value pairs separated by a newline character (\n). The name can be one of nodes, walletfile, or walletpassword. The parameter string should at least specify the ONS configuration nodes attribute as a list of host:port pairs separated by a 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.

Parameters:
onsConfigStr - The configuration string for remote ONS subscription.
Throws:
java.sql.SQLException

getConnection

java.sql.Connection getConnection(java.util.Properties labels)
                                  throws java.sql.SQLException
Attempts to obtain a database connection with the requested connection labels.
Parameters:
labels - The requested connection labels.
Returns:
A Connection to the database.
Throws:
java.sql.SQLException - if a database-access error occurs.

getConnection

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.
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.

registerConnectionLabelingCallback

void registerConnectionLabelingCallback(ConnectionLabelingCallback cbk)
                                        throws java.sql.SQLException
Registers a connection labeling callback with the underlying connection pool.
Parameters:
cbk - The ConnectionLabelingCallback object to be registered.
Throws:
java.sql.SQLException - If there is a callback already registered with the pool.

removeConnectionLabelingCallback

void removeConnectionLabelingCallback()
                                      throws java.sql.SQLException
Removes the ConnectionLabelingCallback object registered with the underlying connection pool, if any.
Throws:
java.sql.SQLException - If callback removal fails.

registerConnectionAffinityCallback

void registerConnectionAffinityCallback(ConnectionAffinityCallback cbk)
                                        throws java.sql.SQLException
Registers a connection affinity callback on the connection pool.
Parameters:
cbk - Affinity Callback object that must be registered.
Throws:
java.sql.SQLException - If callback registration fails.

removeConnectionAffinityCallback

void removeConnectionAffinityCallback()
                                      throws java.sql.SQLException
Removes the ConnectionAffinityCallback object registered on the connection pool.
Throws:
java.sql.SQLException - If callback removal fails.

getConnectionProperties

java.util.Properties getConnectionProperties()
Gets the connection properties that are set on this data source.
Returns:
Connection properties.

getConnectionProperty

java.lang.String getConnectionProperty(java.lang.String propertyName)
Gets the specified connection property that are set on this data source.
Parameters:
propertyName - The name of the specified property.
Returns:
The value of the inquired connection property. Null if the property is not set.

setConnectionProperty

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, the oracle.jdbc.pool.OracleDataSource in the Oracle JDBC driver.
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

setConnectionProperties

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, the oracle.jdbc.pool.OracleDataSource in the Oracle JDBC driver.
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

getConnectionFactoryProperties

java.util.Properties getConnectionFactoryProperties()
Gets the connection factory properties that are set on this data source.
Returns:
Connection factory properties.

getConnectionFactoryProperty

java.lang.String getConnectionFactoryProperty(java.lang.String propertyName)
Gets the specified connection factory property that are set on this data source.
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

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.

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

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.

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.

getMaxConnectionReuseTime

long getMaxConnectionReuseTime()
Gets the maximum connection reuse time property value. See property description in setMaxConnectionReuseTime().
Returns:
Maximum connection reuse time (in seconds).

setMaxConnectionReuseTime

void setMaxConnectionReuseTime(long maxConnectionReuseTime)
                               throws java.sql.SQLException
Sets the maximum connection reuse time property. This property specifies the maximum time any connection can potentially be reused after which the pool removes and closes a connection. The value is specified in seconds and must be greater than 0. For example, if the specified value is 3600 seconds, then when a connection is in existence for more than 3600 seconds, the connection is closed and removed from the pool. Connections are closed gracefully after they are returned to the pool and the specified property value has been exceeded. Default is 0, which means this feature is not enabled.
Parameters:
maxConnectionReuseTime - Maximum connection reuse time (in seconds).
Throws:
java.sql.SQLException

getMaxConnectionReuseCount

int getMaxConnectionReuseCount()
Gets the maximum connection reuse count property value. See property description in setMaxConnectionReuseCount().
Returns:
Maximum connection reuse count.

setMaxConnectionReuseCount

void setMaxConnectionReuseCount(int maxConnectionReuseCount)
                                throws java.sql.SQLException
Sets the maximum connection reuse count property. This property specifies the maximum number of times any connection can be reused after which the pool removes and closes a connection. The value must be greater than 0 for this feature to be enabled. For example, if the specified value is 100, then when a connection is reused or borrowed 100 times from the pool, it is closed and removed from the pool. Connections are closed gracefully after they are returned to the pool and the property value has been exceeded. Default is 0, which means this feature is not enabled.
Parameters:
maxConnectionReuseCount - Maximum connection reuse count.
Throws:
java.sql.SQLException

getStatistics

JDBCConnectionPoolStatistics getStatistics()
Gets the statistics of the connection pool.
Returns:
The statistics of the connection pool.

registerConnectionInitializationCallback

void registerConnectionInitializationCallback(ConnectionInitializationCallback cbk)
                                              throws java.sql.SQLException
Registers a connection initialization callback.
Parameters:
cbk - The ConnectionInitializationCallback object to be registered.
Throws:
java.sql.SQLException - If there is a callback already registered with the pool.

unregisterConnectionInitializationCallback

void unregisterConnectionInitializationCallback()
                                                throws java.sql.SQLException
Unregisters the connection initialization callback on this pool.
Throws:
java.sql.SQLException - If callback removal fails.

getConnectionInitializationCallback

ConnectionInitializationCallback getConnectionInitializationCallback()
Obtains the registered connection initialization callback, if any.
Returns:
The registered ConnectionInitializationCallback, or null if there is no callback registered.

Skip navigation links

Oracle® Universal Connection Pool for JDBC Java API Reference
12c Release 1 (12.1)

E17662-07


Copyright © 2007, 2013, Oracle and/or its affiliates. All rights reserved.