You are viewing the documentation for Blueriq 14. Documentation for other versions is available in our documentation directory.

Introduction

Three types of datasources can be configured in the Java web application: JDBC and JNDI. A datasource must be defined in the application.properties file. The development tools component provides a web UI for modifying the properties file and can be used instead of editing the file directly.

The following sections document all the configuration values available when using the properties file and provide a brief overview of using the development plugin for managing the datasources.

Important

This page describes only how a datasource is configured. Using the datasource is outside the scope of this page. Check the documentation of the plugin you intend to use for information on how a datasource is supposed to be used.

When configuring multiple connections, please make sure they have separate datasources. Using the same datasource is known to cause errors.

Using the properties file

Configuring a JDBC datasource

Configuring a JDBC datasource named datasource_name must be done by setting the following mandatory properties:

blueriq.connection.datasource_name.sql.type=jdbc
blueriq.connection.datasource_name.sql.url=
blueriq.connection.datasource_name.sql.driver=
blueriq.connection.datasource_name.sql.username=
blueriq.connection.datasource_name.sql.password=

The value of these parameters depend on which type of database the connection is made to, so details can be found in the documentation specific to the database type.

A number of optional parameters exist for configuring the connection pool settings. They can be used in constructs similar to 

blueriq.connection.datasource_name.sql.poolInitialSize=5

The parameters are:

ParameterDefaultDescription
poolInitialSize0The initial number of connections that are created when the pool is started.
poolMaxTotal8The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit.
poolMaxIdle8The maximum number of connections that can remain idle in the pool, without extra ones being released, or negative for no limit.
poolMinIdle0The minimum number of connections that can remain idle in the pool, without extra ones being created, or zero to create none.
poolMaxWait-1The 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.

Disclaimer

The descriptions above and the default values are taken from the Apache Commons DBCP website.

Not setting a connection pool optional parameter results in a DEBUG message in the log in the form: SqlConnectionData datasource_name has no poolMaxTotal property set explicitly. Default value 8 will be used.

Setting a connection pool parameter to an invalid value will result in a WARNING message in the log in the form: SqlConnectionData datasource_name was initialized with poolMaxTotal=eight, but it is not a valid number. Default value 8 will be used.

Using the development plugin settings always creates the optional settings in the properties file. See more details in the development plugin section.

Configuring a JNDI datasource

Configuring a JNDI datasource named datasource_name must be done by setting the following mandatory properties:

blueriq.connection.datasource_name.sql.type=jndi
blueriq.connection.datasource_name.sql.jndi=jndi_resource_name

The procedure of creating a JNDI datasource is container-specific. Please consult the documentation of the application server running the application on how to create a JNDI datasource.

Using the development plugin

Assuming the development tools component is installed, the Settings widget can be started by using the button in the top right corner of the dashboard (see Using the development dashboard).

The Connections tab will show all the available connections. Managing the database connections is done in the Sql section.

To add a new connection, use the New Sql connection section at the bottom of the page, provide a name for the new connection and click Add new connection. Creating a new JDBC connection named datasource_name should yield the following result:

Using the tooltips provides extra information about what each setting does.

Do not forget to save your changes using the Save button. Saving will update application.properties with the changes. The settings are reloaded in the session when the Settings window is closed if changes were saved.