DB Query resource adaptor configuration

You configure the DB Query resource adaptor using SLEE profiles. A single configuration property is used to point to a master configuration profile for the resource adaptor entity. This configuration profile in turn references a number of other profiles that configure the datasources. For each datasource configuration profile specified, the resource adaptor will create a DataSource object using the given class name, then set the other profile attributes as datasource properties.

To configure DB Query resource adaptor entities, use the following types of resource adaptor configuration:

And see the configuration example, which sets up two different datasource configurations.

Warning You should set a network timeout to avoid possible long or indefinite waiting for a response from the database in the event of a network or database failure. See Network timeout configuration.

Resource adaptor configuration properties

The DB Query resource adaptor has the following resource adaptor configuration properties:

Name Type Description

ConfigProfile

String

The name of the profile to configure this resource adaptor entity

ConfigProfileAddNodeSuffix

boolean

Flag to indicate that per-node configuration profiles should be used (see details below)

CacheNonTransactionQueryResultSets

false

Enables improved RA behaviour under overload conditions by caching results and closing all resources immediately

Resource adaptor configuration profile

The DbQueryConfigProfile profile has the following attributes:

Name Type Description

DataSourceProfileIDs

ProfileID[]

List of DataSource profiles. These will always be tried in the order given.

TestSql

String

An SQL statement to be executed against the datasources to test for availability

ProfilePollTime

long (ms)

Time between polling for changes to datasource profiles

MaxSyncTransactionAge

long (ms)

Maximum time a synchronous transaction can exist before assuming the service has neglected to end it and it is marked as 'lost'

MaxLostTransactionAge

long (ms)

Maximum time a transaction will stay in the 'lost' transaction list before being forcibly ended

TransactionScanTime

long (ms)

Time between scanning sync and lost transactions

Datasource configuration profiles

The DbQueryDataSourceProfile profile has the following attributes:

Name Type (units) Description

Description

String

A description for this datasource, will be used in log messages and statistics parameter set names

AdminEnable

boolean

Flag to enable/disable this datasource administratively

DataSourceClass

String

The Java class name for the datasource, will be instantiated via reflection

DataSourceName

String

Value for the DataSourceName property, if needed by the datasource (typically not needed)

Url

String

Value for the Url property if used by this datasource (not needed if ServerName/PortNumber/DatabaseName are specified)

URL

String

Value for the URL property if used by this datasource (not needed if ServerName/PortNumber/DatabaseName are specified)

ServerName

String

Value for the ServerName property if used by this datasource (not needed if Url or URL is specified)

PortNumber

int

Value for the PortNumber property if used by this datasource (not needed if Url or URL is specified)

User

String

Value to be passed to the setUser() method on the datasource

Password

String

Value to be passed to the setPassword() method on the datasource

DatabaseName

String

Value for the DatabaseName property if used by this datasource (not needed if Url or URL is specified)

DataSourceProperties

String[]

Arbitrary values to be passed to set PropertyName() methods on the datasource (see details below)

ConnectionProperties

String

Properties to be passed to the setConnectionProperties method on the datasource (see details below)

QueryTimeout

long (ms)

Timeout for a query, including getting a connection, preparing and executing the statement. On DatabaseFutureResult method calls the shorter timeout will always be in effect (no default, must be specified)

AvailabilityPollInterval

long (ms)

How frequently to poll for availability when a datasource is marked unavailable (default: 2000ms)

WorkerThreads

int

The number of threads in the worker thread pool used to invoke JDBC operations (default: 30)

WorkQueueMaxSize

int

The maximum number of work items in a queue before they are rejected (default: 600)

ConnPoolGetConnectionTimeout

long (ms)

Timeout for retrieving a connection from the pool (default: 5000ms)

ConnPoolMaxConnectionAge

long (ms)

The maximum time a physical connection may be used before it will be closed instead of being returned to the pool (default: 60000ms)

ConnPoolMaxConns

int

The maximum sum of connections currently in use and available in pool (default: 30)

ConnPoolSize

int

The maximum number of available connections kept in pool (default: 30)

ConnPoolMinSize

int

The minimum number of available connections that a pool maintains

ConnPoolMaxIdle

long (ms)

Maximum idle time for a connection before it is closed and removed from the pool (default: 30000ms)

ConnPoolIdleInterval

long (ms)

How frequently to check for idle connections (default: 500ms)

IdleCheckTime

long (ms)

How frequently to scan the connection pool for idle connections (default: 35000ms)

WarningAlarmDuration

long (ms)

How long overload alarms will stay active before being cleared (default: 30000ms)

Note The Url/URL attribute exists with both title case and upper case because some datasources use one form and some use the other.

Datasource properties profile attribute

The elements of the array for the DataSourceProperties profile attribute have the following format:

Name/Type/Value

where

  • Name is the DataSource property name

  • Type is the property type (a Java primitive or a Java class which has a constructor that takes a single java.lang.String argument)

  • Value is the String representation of the value.

For example, to set the loginTimeout property on an Oracle datasource to 10, the array element would be:

loginTimeout/java.lang.Integer/10

Type can be java.util.Properties, in which case the Value must be a java.lang.String that can be parsed by the java.util.Properties.load(InputStream) method ("name: value" separated by line breaks). Line breaks in Ant build files can be specified by using the XML entity 
.

Oracle connection properties

The Oracle datasource has another means of setting connection properties: the setConnectionProperties(java.util.Properties) method. These can be specified by the ConnectionProperties attribute.

The value of this property must be a java.lang.String that can be parsed by the java.util.Properties.load(InputStream) method ("name: value" separated by line breaks). Line breaks in Ant build files can be specified by using the XML entity 
.

Per-node configuration

Per-node configuration (when nodes in a cluster require different configurations) is supported by having separate DbQueryConfigProfile profiles for each node. The resource adaptor must be configured with the configuration property ConfigProfileAddNodeSuffix set to true and a profile created for each node, named as follows:

  • ConfigProfile __ NodeID

For example, if the resource adaptor configuration specified ConfigProfile=MySQLConfig and ConfigProfileAddNodeSuffix=true on a two-node cluster with nodes 101 and 102, then two profiles would be needed:

  • MySQLConfig__101

  • MySQLConfig__102

If a new node is added to the cluster and the resource adaptor is using per-node configuration, an appropriately named profile must be created before activating the resource adaptor entity on the new node.

Previous page Next page