RDBMS datasources in WSO2 products use Tomcat JDBC connection pool (
org.apache.tomcat.jdbc.pool). It is common to all components that access databases for data persistence, such as the registry, user management (if configured against a JDBC userstore), etc.
You can configure the datasource connection pool parameters, such as how long a connection is persisted in the pool, using the datasource configuration parameters section that appears in the product management console when creating a datasource. Click and expand the option as shown below:
Following are descriptions of the parameters you can configure. For more details on datasource configuration parameters, see ApacheTomcat JDBC Connection Pool guide.
|Transaction isolation||The default |
|Initial Size (int)|
The initial number of connections created, when the pool is started. Default value is zero.
|Max. Active (int)|
Maximum number of active connections that can be allocated from this pool at the same time. The default value is 100.
|Max. Idle (int)|
Maximum number of connections that should be kept in the pool at all times. Default value is 8. Idle connections are checked periodically (if enabled), and connections that have been idle for longer than
|Min. Idle (int)|
Minimum number of established connections that should be kept in the pool at all times. The connection pool can shrink below this number, if validation queries fail. Default value is zero. For more information, see testWhileIdle.
|Max. Wait (int)|
Maximum number of milliseconds that the pool waits (when there are no available connections) for a connection to be returned before throwing an exception. Default value is 30000 (30 seconds).
|Validation Query (String)|
The SQL query used to validate connections from this pool before returning them to the caller. If specified, this query does not have to return any data, it just can't throw a SQLException. The default value is null. Example values are SELECT 1 (mysql), select 1 from dual (oracle), SELECT 1 (MS Sql Server).
|Test On Return (boolean)|
Used to indicate if objects will be validated before returned to the pool. The default value is false.
For a true value to have any effect, the
|Test On Borrow (boolean)|
Used to indicate if objects will be validated before borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another. Default value is false.
For a true value to have any effect, the
|Test While Idle (boolean)|
The indication of whether objects will be validated by the idle object evictor (if any). If an object fails to validate, it will be dropped from the pool. The default value is false and this property has to be set in order for the pool cleaner/test thread to run. For more information, see timeBetweenEvictionRunsMillis .
For a true value to have any effect, the validationQuery parameter must be set to a non-null string.
|Time Between Eviction Runs Mills (int)|
Number of milliseconds to sleep between runs of the idle connection validation/cleaner thread. This value should not be set under 1 second. It indicates how often we check for idle, abandoned connections, and how often we validate idle connections. The default value is 5000 (5 seconds).
|Minimum Evictable Idle Time (int)|
Minimum amount of time an object may sit idle in the pool before it is eligible for eviction. The default value is 60000 (60 seconds).
|Remove Abandoned (boolean)|
Flag to remove abandoned connections if they exceed the removeAbandonedTimout. If set to true, a connection is considered abandoned and eligible for removal, if it has been in use longer than the
|Remove Abandoned Timeout (int)||Timeout in seconds before an abandoned (in use) connection can be removed. The default value is 60 (60 seconds). The value should be set to the longest running query that your applications might have.|
|Log Abandoned (boolean)||Flag to log stack traces for application code which abandoned a connection. Logging of abandoned connections, adds overhead for every connection borrowing, because a stack trace has to be generated. The default value is false.|
|Auto Commit (boolean)||The default auto-commit state of connections created by this pool. If not set, default is JDBC driver default. If not set, then the |
|Default Read Only (boolean)||The default read-only state of connections created by this pool. If not set then the |
|Default Catalog (String)||The default catalog of connections created by this pool.|
|Validator Class Name (String)||The name of a class which implements the |
|Connection Properties (String)|
Connection properties that will be sent to our JDBC driver when establishing new connections. Format of the string must be
|Init SQL||Ability to run a SQL statement exactly once, when the connection is created.|
|JDBC Interceptors||Flexible and pluggable interceptors to create any customizations around the pool, the query execution and the result set handling.|
|Validation Interval (long)||To avoid excess validation, only run validation at most at this frequency - time in milliseconds. If a connection is due for validation, but has been validated previously within this interval, it will not be validated again. The default value is 30000 (30 seconds).|
|JMX Enabled (boolean)||Register the pool with JMX or not. The default value is true.|
|Fair Queue (boolean)||Set to true, if you wish that calls to |
|Abandon When Percentage Full (int)||Connections that have been abandoned (timed out) will not get closed and reported up, unless the number of connections in use are above the percentage defined by |
|Max Age (long)||Time in milliseconds to keep this connection. When a connection is returned to the pool, the pool will check to see if the current time when connected, is greater than the |
|Use Equals (boolean)||Set to true, if you wish the |
|Suspect Timeout (int)||Timeout value in seconds. Default value is zero. Similar to to the |
|Alternate User Name Allowed (boolean)||By default, the |
The pool can however be configured to allow use of different credentials each time a connection is requested. To enable the functionality described in the