XML Configuration (DatabaseService)

Adding a New Database Alias

Note: If you want to modify the configuration file for a service directly in the file system, you will find the appropriate file in the configuration file ./etc/factory.xml. Details about the configuration can be found in the respective documentation of a service. Otherwise, you can edit the configuration file directly via the respective service in the GUI.

The following XML fragment can be used to add a new database alias. See also section Adding a New Database Alias with the Admin Console.

<Call name="initPool">
<Arg>
<New class="com.ebd.hub.services.database.DatabaseSettings">
<Set name="alias">db</Set>
<Set name="catalogName">wbv</Set>
<Set name="database">jdbc:postgresql://server:5432/db</Set>
<Set name="driver">org.postgresql.Driver</Set>
<Set name="user">dummy</Set>
<Set name="password">dummy</Set>
<Set name="lowerCase">lower</Set>
<Set name="minSize">2</Set>
<Set name="maxSize">2</Set>
<Set name="allowGrowing">true</Set>
<Set name="idleTime">300000</Set>
<Set name="sqlCommand">select obj_id from xml_unitrealm</Set>
<Set name="rollback">false</Set>
<Set name="caching">true</Set>
<Set name="checkConnection">false</Set>
<Set name="supportsStream">false</Set>
<Set name="maxStatementLength">32000</Set>
<Call name="addNamedProperty">
<Arg>propertyname</Arg>
<Arg>propertyvalue</Arg>
</Call>
</New>
</Arg>
</Call>

The parameter have the following meaning.

alias

The database alias to use.

catalogName

The name of the catalogue (schema) within the database. If omitted, the alias name is used.

database

The JDBC URL that represents the connection to the database. This URL is database-dependent, e.g. jdbc:mysql://myserver:3306/db.

driver

The class that represents the driver of the JDBC driver. This setting is database-dependent, e.g. org.gjt.mm.mysql.Driver.

user

The username to use for authenticating with the database.

password

The password to use for authenticating with the database. The exact procedure is described in section Admin Console (Administration).

lowerCase

The name of the method for converting text to lowercase. Normally, this information is provided by the JDBC driver itself, but there are exceptions where an explicit specification is required.

minSize

The initial size of the connection pool when starting the service.

maxSize

The maximum size of the connection pool. If you want to use the default size, use value -1.

allowGrowing

If true, the pool is allowed to grow when all initially created connections have been issued to applications and another one is needed.

idleTime

Specifies the time in milliseconds that a connection must be unused in the pool before its validity is checked by the DatabaseService.

sqlCommand

The SQL command to verify the validity of a database connection. If no command is specified, the list of available tables is queried. However, this information is cached by some JDBC drivers so that a connection can be considered valid, even though it is no longer.

rollback

Set this option if the database works transaction-based. If you specify false, no attempt is made to start a transaction, which would otherwise result in an error message with some databases. Attention: If you specify of false for a transactional database, the attempt to start a transaction is ignored. Commit and rollback also have no effect, although the database would actually be able to do that.

caching

If set to true, SQL statements used by applications are cached. All statements must be checked by the DatabaseService and adapted if necessary. Therefore, it makes sense to save the result of these checks/changes for future use if your system has sufficient resources. However, if you primarily use dynamic statements, explicit deactivation of this option may make sense to avoid unnecessary memory usage for never-reused SQL statements.

checkConnection

If this item is activated, the validity of a connection is checked before it is issued to an application from the pool. This reduces the performance of the system, but ensures that the application gets a connection that works and has not become invalid since the last check.

supportsStream

Determines whether the linked database supports so-called character streams as parameters for writing to and reading from a database. This information is used, for example, by the JDO service to decide whether an object to be written into the database should be 'stripped' or not.

maxStatementLength

Sets the maximum size of an SQL statement. This setting can be used by applications to decide if a statement can be used with a character stream or not.

addNamedProperty

Allows setting so-called ConnectionProperties. For many JDBC drivers, the way to connect to the database can be controlled by setting key-value pairs. The first argument represents the key, the second represents the value to be set. Example: transaction level and none.
Which value pairs can be set depends on the JDBC driver used. Therefore, please refer to the documentation of the respective driver.

Setting the Time Between Two Connection Checks

The following XML fragment sets the time to wait between two connection checks.

<Set name="idleTime">200000</Set>

The idleTime should not be confused with the Time interval specified when creating a database connection. The idleTime indicates the time when a check should take place in principle. So if a check is set to every five minutes and the Time interval of a connection is set to 10 minutes, such a connection will be checked at the earliest on the second run.