Top Description Fields Methods
org.apache.tomcat.jdbc.pool

public Interface PoolConfiguration

Known Direct Subinterfaces
org.apache.tomcat.jdbc.pool.jmx.ConnectionPoolMBean
Known Direct Implementers
org.apache.tomcat.jdbc.pool.PoolProperties, org.apache.tomcat.jdbc.pool.DataSourceProxy
Imports
java.util.Properties, org.apache.tomcat.jdbc.pool.PoolProperties.InterceptorDefinition

A list of properties that are configurable for a connection pool. The DataSource object also implements this interface so that it can be easily configured through an IoC container without having to specify a secondary object with a setter method.

Field Summary

Modifier and TypeField and Description
public static final String
PKG_PREFIX

JMX prefix for interceptors that register themselves with JMX

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

percentage - a value between 0 and 100 to indicate when connections that have been abandoned/timed out are considered abandoned
getAbandonWhenPercentageFull
()

Connections that have been abandoned (timed out) wont get closed and reported up unless the number of connections in use are above the percentage defined by abandonWhenPercentageFull.

public boolean

Returns:

true if the pool should commit when a connection is returned to it
getCommitOnReturn
()

public String

Returns:

the connection properties
getConnectionProperties
()

The connection properties that will be sent to the JDBC driver when establishing new connections.

public Object

Returns:

the javax.sql.DataSource to be used for creating connections to be pooled or null if a Driver is used.
getDataSource
()

Returns a datasource, if one exists that is being used to create connections.

public String

Returns:

the JNDI string or null if not set
getDataSourceJNDI
()

Returns the JNDI string configured for data source usage.

public Properties

Returns:

database properties that are passed into the java.sql.Driver#connect(String, Properties) method.
getDbProperties
()

Returns the database properties that are passed into the java.sql.Driver#connect(String, Properties) method.

public Boolean

Returns:

the default auto commit setting, null is Driver default.
getDefaultAutoCommit
()

The default auto-commit state of connections created by this pool.

public String

Returns:

the default catalog, null if not set and accepting the driver default.
getDefaultCatalog
()

If non null, during connection creation the method java.sql.Connection#setCatalog(String) will be called with the set value.

public Boolean

Returns:

null if not set and accepting the driver default otherwise the read only value
getDefaultReadOnly
()

If non null, during connection creation the method java.sql.Connection#setReadOnly(boolean) will be called with the set value.

public int

Returns:

driver transaction isolation level, or -1 DataSourceFactory#UNKNOWN_TRANSACTIONISOLATION if not set.
getDefaultTransactionIsolation
()

Returns the default transaction isolation level.

public String

Returns:

fully qualified JDBC driver name.
getDriverClassName
()

The fully qualified Java class name of the JDBC driver to be used.

public int

Returns:

number of connections to be started when pool is started
getInitialSize
()

Returns the number of connections that will be established when the connection pool is started.

public String

Returns:

the init SQL used to run against the DB or null if not set
getInitSQL
()

A custom query to be run when a connection is first created.

public String

Returns:

the interceptors that are used for connections. Example format: 'ConnectionState(useEquals=true,fast=yes);ResetAbandonedTimer'
getJdbcInterceptors
()

A semicolon separated list of classnames extending org.apache.tomcat.jdbc.pool.JdbcInterceptor class.

public PoolProperties.InterceptorDefinition[]

Returns:

an array of interceptors that have been configured
getJdbcInterceptorsAsArray
()

Returns the getJdbcInterceptors() as an array of objects with properties and the classes.

public boolean

Returns:

true if errors that happen during validation will be logged
getLogValidationErrors
()

Returns true if errors that happen during validation will be logged

public int

Returns:

the maximum number of connections used by this pool
getMaxActive
()

The maximum number of active connections that can be allocated from this pool at the same time.

public long

Returns:

the time in milliseconds a connection will be open for when used
getMaxAge
()

Time in milliseconds to keep this connection before reconnecting.

public int

Returns:

the maximum number of idle connections.
getMaxIdle
()

The maximum number of connections that should be kept in the idle pool if isPoolSweeperEnabled() returns false.

public int

Returns:

the number of milliseconds to wait for a connection to become available if the pool is maxed out.
getMaxWait
()

The maximum number of milliseconds that the pool will wait (when there are no available connections and the getMaxActive has been reached) for a connection to be returned before throwing an exception.

public int

Returns:

the minimum amount of idle time in milliseconds before a connection is considered idle and eligible for eviction.
getMinEvictableIdleTimeMillis
()

The minimum amount of time an object must sit idle in the pool before it is eligible for eviction.

public int

Returns:

the minimum number of idle or established connections
getMinIdle
()

The minimum number of established connections that should be kept in the pool at all times.

public String

Returns:

the name of the pool, should be unique in a JVM
getName
()

Returns the name of the connection pool.

public int

Returns:

unknown value
getNumTestsPerEvictionRun
()

Property not used

public String

Returns:

the password in string format
getPassword
()

Returns the password used when establishing connections to the database.

public String

Returns:

the pool name
getPoolName
()

public boolean

Returns:

true if the pool is configured to propagate and not clear the thread interrupt state
getPropagateInterruptState
()

Returns true if the pool is configured to propagate interrupt state of a thread.

public int

Returns:

the time in seconds before a used connection can be considered abandoned
getRemoveAbandonedTimeout
()

The time in seconds before a connection can be considered abandoned.

public boolean

Returns:

true if the pool should rollback when a connection is returned to it
getRollbackOnReturn
()

public int

Returns:

Returns the time in seconds to pass before a connection is marked an abandoned suspect.
getSuspectTimeout
()

Returns the time in seconds to pass before a connection is marked an abandoned suspect.

public int

Returns:

the sleep time in between validations in milliseconds
getTimeBetweenEvictionRunsMillis
()

The number of milliseconds to sleep between runs of the idle connection validation, abandoned cleaner and idle pool resizing.

public String

Returns:

the configured URL for this connection pool
getUrl
()

The URL used to connect to the database

public boolean

Returns:

true if java.sql.Connection#close() has been invoked.
getUseDisposableConnectionFacade
()

Returns true if this connection pool is configured to use a connection facade to prevent re-use of connection after java.sql.Connection#close() has been invoked

public boolean

Returns:

true if a lock is used.
getUseLock
()

Return true if a lock should be used when operations are performed on the connection object.

public String

Returns:

the username used to establish the connection with
getUsername
()

Returns the username used to establish the connection with

public boolean

Returns:

true if the statements are wrapped
getUseStatementFacade
()

Returns true if this connection pool is configured to wrap statements in order to enable equals() and hashCode() methods to be called on the closed statements if any statement proxy is set.

public long

Returns:

the validation interval in milliseconds
getValidationInterval
()

avoid excess validation, only run validation at most at this frequency - time in milliseconds.

public String

Returns:

the query used for validation or null if no validation is performed
getValidationQuery
()

The SQL query that will be used to validate connections from this pool before returning them to the caller or pool.

public int

Returns:

the timeout value in seconds
getValidationQueryTimeout
()

The timeout in seconds before a connection validation queries fail.

public Validator

Returns:

the optional validator object - may be null
getValidator
()

public String

Returns:

the name of the optional validator class - may be null
getValidatorClassName
()

Return the name of the optional validator class - may be null.

public boolean

Returns:

true
isAccessToUnderlyingConnectionAllowed
()

Property not used.

public boolean

Returns:

true if getConnection(username,password) is honored, false if it is ignored.
isAlternateUsernameAllowed
()

Returns true if the call getConnection(username,password) is allowed.

public Boolean

Returns:

the default auto commit setting, null is Driver default.
isDefaultAutoCommit
()

The default auto-commit state of connections created by this pool.

public Boolean

Returns:

null if not set and accepting the driver default otherwise the read only value
isDefaultReadOnly
()

If non null, during connection creation the method java.sql.Connection#setReadOnly(boolean) will be called with the set value.

public boolean

Returns:

true if a fair waiting queue is being used
isFairQueue
()

Returns true if a fair queue is being used by the connection pool

public boolean

Returns:

true to ignore exceptions
isIgnoreExceptionOnPreLoad
()

public boolean

Returns:

true if the mbean object will be created upon startup.
isJmxEnabled
()

If set to true, the connection pool creates a org.apache.tomcat.jdbc.pool.jmx.ConnectionPoolMBean object that can be registered with JMX to receive notifications and state about the pool.

public boolean

Returns:

true if the connection pool logs stack traces when connections are borrowed from the pool.
isLogAbandoned
()

boolean flag to set if stack traces should be logged for application code which abandoned a Connection.

public boolean

Returns:

true if a background thread is or will be enabled for this pool
isPoolSweeperEnabled
()

Returns true if the pool sweeper is enabled for the connection pool.

public boolean

Returns:

true if abandoned connections can be closed and expelled out of the pool
isRemoveAbandoned
()

boolean flag to remove abandoned connections if they exceed the removeAbandonedTimeout.

public boolean

Returns:

true if the connection is to be validated upon borrowing a connection from the pool
isTestOnBorrow
()

The indication of whether objects will be validated before being borrowed from the pool.

public boolean

Returns:

true if we should run the validation query upon connect
isTestOnConnect
()

Returns true if we should run the validation query when connecting to the database for the first time on a connection.

public boolean

Returns:

true if validation should take place after a connection is returned to the pool
isTestOnReturn
()

The indication of whether objects will be validated after being returned to the pool.

public boolean

Returns:

true if validation should take place during idle checks
isTestWhileIdle
()

Set to true if query validation should take place while the connection is idle.

public boolean

Returns:

true if pool uses String#equals(Object) instead of == when comparing method names on java.sql.Connection methods
isUseEquals
()

Set to true if you wish the ProxyConnection class to use String.equals instead of == when comparing method names.

public void
setAbandonWhenPercentageFull(int
a value between 0 and 100 to indicate when connections that have been abandoned/timed out are considered abandoned
percentage
)

Connections that have been abandoned (timed out) wont get closed and reported up unless the number of connections in use are above the percentage defined by abandonWhenPercentageFull.

public void
setAccessToUnderlyingConnectionAllowed(boolean
parameter ignored
accessToUnderlyingConnectionAllowed
)

No-op

public void
setAlternateUsernameAllowed(boolean
- set true if getConnection(username,password) is honored, false if it is to be ignored.
alternateUsernameAllowed
)

Set to true if the call getConnection(username,password) is allowed and honored..

public void
setCommitOnReturn(boolean
set to true if the pool should call java.sql.Connection#commit() when a connection is returned to the pool. Default is false
commitOnReturn
)

Set to true if you want the connection pool to commit any pending transaction when a connection is returned.

public void
setConnectionProperties(String
properties - Format of the string is [propertyName=property;]* Example: prop1=value1;prop2=value2
connectionProperties
)

The properties that will be passed into java.sql.Driver#connect(String, Properties) method.

public void
setDataSource(Object
the javax.sql.DataSource to be used for creating connections to be pooled.
ds
)

Injects a datasource that will be used to retrieve/create connections.

public void
setDataSourceJNDI(String
-the JNDI string @TODO specify the rules here.
jndiDS
)

Configure the connection pool to use a DataSource according to PoolConfiguration#setDataSource(Object) But instead of injecting the object, specify the JNDI location.

public void
setDbProperties(Properties
The database properties
dbProperties
)

Overrides the database properties passed into the java.sql.Driver#connect(String, Properties) method.

public void
setDefaultAutoCommit(Boolean
default auto commit setting, null is Driver default.
defaultAutoCommit
)

The default auto-commit state of connections created by this pool.

public void
setDefaultCatalog(String
null if not set and accepting the driver default.
defaultCatalog
)

If non null, during connection creation the method java.sql.Connection#setCatalog(String) will be called with the set value.

public void
setDefaultReadOnly(Boolean
null if not set and accepting the driver default.
defaultReadOnly
)

If non null, during connection creation the method java.sql.Connection#setReadOnly(boolean) will be called with the set value.

public void
public void
setDriverClassName(String
a fully qualified Java class name of a java.sql.Driver implementation.
driverClassName
)

The fully qualified Java class name of the JDBC driver to be used.

public void
setFairQueue(boolean
true to use a fair queue
fairQueue
)

Set to true if you wish that calls to getConnection should be treated fairly in a true FIFO fashion.

public void
setIgnoreExceptionOnPreLoad(boolean
set to true if you want to ignore error of connection creation while initializing the pool.
ignoreExceptionOnPreLoad
)

Set to true if you want to ignore error of connection creation while initializing the pool.

public void
setInitialSize(int
the number of connections to be established.
initialSize
)

Set the number of connections that will be established when the connection pool is started.

public void
setInitSQL(String
the init SQL used to run against the DB or null if no query should be executed
initSQL
)

A custom query to be run when a connection is first created.

public void
setJdbcInterceptors(String
the interceptors that are used for connections. Example format: 'ConnectionState(useEquals=true,fast=yes);ResetAbandonedTimer'
jdbcInterceptors
)

A semicolon separated list of classnames extending org.apache.tomcat.jdbc.pool.JdbcInterceptor class.

public void
setJmxEnabled(boolean
set to to if the mbean object should be created upon startup.
jmxEnabled
)

If set to true, the connection pool creates a org.apache.tomcat.jdbc.pool.jmx.ConnectionPoolMBean object that can be registered with JMX to receive notifications and state about the pool.

public void
setLogAbandoned(boolean
set to true if stack traces should be recorded when DataSource#getConnection() is called.
logAbandoned
)

boolean flag to set if stack traces should be logged for application code which abandoned a Connection.

public void
setLogValidationErrors(boolean
set to true to log validation errors
logValidationErrors
)

Set to true if you wish that errors from validation should be logged as error messages.

public void
setMaxActive(int
hard limit for number of managed connections by this pool
maxActive
)

The maximum number of active connections that can be allocated from this pool at the same time.

public void
setMaxAge(long
the time in milliseconds a connection will be open for when used
maxAge
)

Time in milliseconds to keep this connection before reconnecting.

public void
setMaxIdle(int
the maximum size of the idle pool
maxIdle
)

The maximum number of connections that should be kept in the idle pool if isPoolSweeperEnabled() returns false.

public void
setMaxWait(int
the maximum number of milliseconds to wait.
maxWait
)

The maximum number of milliseconds that the pool will wait (when there are no available connections and the getMaxActive has been reached) for a connection to be returned before throwing an exception.

public void
setMinEvictableIdleTimeMillis(int
the number of milliseconds a connection must be idle to be eligible for eviction.
minEvictableIdleTimeMillis
)

The minimum amount of time an object must sit idle in the pool before it is eligible for eviction.

public void
setMinIdle(int
the minimum number of idle or established connections
minIdle
)

The minimum number of established connections that should be kept in the pool at all times.

public void
setName(String
the name of the pool, should be unique in a runtime JVM
name
)

Sets the name of the connection pool

public void
setNumTestsPerEvictionRun(int
parameter ignored.
numTestsPerEvictionRun
)

Property not used

public void
setPassword(String
The password
password
)

Sets the password to establish the connection with.

public void
setPropagateInterruptState(boolean
- set to true to not clear, but propagate, a threads interrupted state.
propagateInterruptState
)

Configure the pool to propagate interrupt state for interrupted threads waiting for a connection A thread waiting for a connection, can have its wait interrupted, and by default will clear the interrupt flag and throw a PoolExhaustedException If set to true, this behavior will change, while the PoolExhaustedException is still thrown, the threads interrupted state is still set.

public void
setRemoveAbandoned(boolean
set to true if abandoned connections can be closed and expelled out of the pool
removeAbandoned
)

boolean flag to remove abandoned connections if they exceed the removeAbandonedTimeout.

public void
setRemoveAbandonedTimeout(int
the time in seconds before a used connection can be considered abandoned
removeAbandonedTimeout
)

The time in seconds before a connection can be considered abandoned.

public void
setRollbackOnReturn(boolean
set to true if the pool should call java.sql.Connection#rollback() when a connection is returned to the pool. Default is false
rollbackOnReturn
)

Set to true if you want the connection pool to rollback any pending transaction when a connection is returned.

public void
setSuspectTimeout(int
- the amount of time in seconds that has to pass before a connection is marked suspect.
seconds
)

Similar to setRemoveAbandonedTimeout(int) but instead of treating the connection as abandoned, and potentially closing the connection, this simply logs the warning if isLogAbandoned() returns true.

public void
setTestOnBorrow(boolean
set to true if validation should take place before a connection is handed out to the application
testOnBorrow
)

The indication of whether objects will be validated before being borrowed from the pool.

public void
setTestOnConnect(boolean
set to true if we should run the validation query upon connect
testOnConnect
)

Set to true if we should run the validation query when connecting to the database for the first time on a connection.

public void
setTestOnReturn(boolean
true if validation should take place after a connection is returned to the pool
testOnReturn
)

The indication of whether objects will be validated after being returned to the pool.

public void
setTestWhileIdle(boolean
true if validation should take place during idle checks
testWhileIdle
)

Set to true if query validation should take place while the connection is idle.

public void
setTimeBetweenEvictionRunsMillis(int
the sleep time in between validations in milliseconds
timeBetweenEvictionRunsMillis
)

The number of milliseconds to sleep between runs of the idle connection validation, abandoned cleaner and idle pool resizing.

public void
setUrl(String
the configured URL for this connection pool
url
)

Sets the URL used to connect to the database

public void
setUseDisposableConnectionFacade(boolean
true to use a facade
useDisposableConnectionFacade
)

If set to true, the connection will be wrapped with facade that will disallow the connection to be used after java.sql.Connection#close() is called.

public void
setUseEquals(boolean
set to true if the pool should use String#equals(Object) instead of == when comparing method names on java.sql.Connection methods
useEquals
)

Set to true if you wish the ProxyConnection class to use String.equals instead of == when comparing method names.

public void
setUseLock(boolean
set to true if a lock should be used on connection operations
useLock
)

Set to true if a lock should be used when operations are performed on the connection object.

public void
setUsername(String
The user name
username
)

Sets the username used to establish the connection with It will also be a property called 'user' in the database properties.

public void
setUseStatementFacade(boolean
set to true to wrap statements
useStatementFacade
)

Set this to true if you wish to wrap statements in order to enable equals() and hashCode() methods to be called on the closed statements if any statement proxy is set.

public void
setValidationInterval(long
the validation interval in milliseconds
validationInterval
)

avoid excess validation, only run validation at most at this frequency - time in milliseconds.

public void
setValidationQuery(String
the query used for validation or null if no validation is performed
validationQuery
)

The SQL query that will be used to validate connections from this pool before returning them to the caller or pool.

public void
setValidationQueryTimeout(int
The timeout value
validationQueryTimeout
)

The timeout in seconds before a connection validation queries fail.

public void
setValidator(Validator
The validator object
validator
)

Sets the validator object If this is a non null object, it will be used as a validator instead of the validationQuery If this is null, remove the usage of the validator.

public void
setValidatorClassName(String
the name of the optional validator class
className
)

Set the name for an optional validator class which will be used in place of test queries.