When creating a SQL connection for a Blueriq application a set of connection pool parameters are available. These parameters have default values, but they can be overridden to modify the way the connection pool handles connections.
Step-by-step guide
In order to create a SQL connection the following steps are required:
- Open connection properties file.
Enter the connection properties in the following format.
connection.<name>.sql.driver=<database_driver> connection.<name>.sql.minEvictableIdleTimeMillis=1800000 connection.<name>.sql.numTestsPerEvictionRun=3 connection.<name>.sql.password=<encoded_password> connection.<name>.sql.poolInitialSize=0 connection.<name>.sql.poolMaxIdle=8 connection.<name>.sql.poolMaxTotal=8 connection.<name>.sql.poolMaxWait=-1 connection.<name>.sql.poolMinIdle=0 connection.<name>.sql.testOnBorrow=true connection.<name>.sql.testOnReturn=false connection.<name>.sql.testWhileIdle=false connection.<name>.sql.timeBetweenEvictionRunsMillis=-1 connection.<name>.sql.type=<connection_type> connection.<name>.sql.url=<database_url> connection.<name>.sql.username=<username> connection.<name>.sql.validationQuery= connection.<name>.sql.validationQueryTimeout=-1
- Save the file
Connection Pool Parameters
Parameter | Default | Description |
---|---|---|
initialSize | 0 | The initial number of connections that are created when the pool is started. Since: 1.2 |
maxTotal | 8 | The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit. |
maxIdle | 8 | The maximum number of connections that can remain idle in the pool, without extra ones being released, or negative for no limit. |
minIdle | 0 | The minimum number of connections that can remain idle in the pool, without extra ones being created, or zero to create none. |
maxWaitMillis | indefinitely | The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception, or -1 to wait indefinitely. |
validationQuery | The SQL query that will be used to validate connections from this pool before returning them to the caller. The validation query is database specific:
| |
validationQueryTimeout | no timeout | The timeout in seconds before connection validation queries fail. If set to a positive value, this value is passed to the driver via the setQueryTimeout method of theStatement used to execute the validation query. |
testOnCreate | false | The indication of whether objects will be validated after creation. If the object fails to validate, the borrow attempt that triggered the object creation will fail. |
testOnBorrow | true | The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another. |
testOnReturn | false | The indication of whether objects will be validated before being returned to the pool. |
testWhileIdle | false | 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. |
timeBetweenEvictionRunsMillis | -1 | The number of milliseconds to sleep between runs of the idle object evictor thread. When non-positive, no idle object evictor thread will be run. |
numTestsPerEvictionRun | 3 | The number of objects to examine during each run of the idle object evictor thread (if any). |
minEvictableIdleTimeMillis | 1000 * 60 * 30 | The minimum amount of time an object may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any). |
Overview
Content Tools