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:

  1. Open connection properties file.
  2. 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

  3. Save the file.

Connection Pool Parameters

ParameterDefaultDescription
initialSize0The initial number of connections that are created when the pool is started. 
Since: 1.2
maxTotal8The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit.
maxIdle8The maximum number of connections that can remain idle in the pool, without extra ones being released, or negative for no limit.
minIdle0The minimum number of connections that can remain idle in the pool, without extra ones being created, or zero to create none.
maxWaitMillisindefinitely

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:

  • SQL Server: SELECT 1
  • Oracle,: SELECT 1 FROM DUAL
validationQueryTimeoutno timeoutThe 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.
testOnCreatefalseThe 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.
testOnBorrowtrueThe 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.
testOnReturnfalseThe indication of whether objects will be validated before being returned to the pool.
testWhileIdlefalseThe 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-1The number of milliseconds to sleep between runs of the idle object evictor thread. When non-positive, no idle object evictor thread will be run.
numTestsPerEvictionRun3The number of objects to examine during each run of the idle object evictor thread (if any).
minEvictableIdleTimeMillis1000 * 60 * 30The 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).