3.6. Database configuration

The Databases for Wolframe are configured in the Database section of the configuration.

3.6.1. PostgreSQL

This section explains how to configure a Postgres database.

Requirements

In order to use a Postgres database in Wolframe you have to configure the loading of the module mod_db_postgresql in the LoadModules section of your configuration. The addressed Postgres database server must be running and the database and the user configured must have been created before.

Configuration settings

The configuration settings for PostgreSQL are splitted in two parts: The database configuration settings and the SSL configuration settings. The following three tables show the PostgreSQL database configuration settings, the PostgreSQL SSL configuration settings and the table with configurable SSL modes:

Table 3.10. PostgreSQL database configuration settings

NameParameterDescription
IdentifieridentifierDatabase identifier used to reference this database.
Hosthost name or IP addressAddress of the PostgreSQL database server. Uses the unix domain socket if not defined.
PortnumberPort of the PostgreSQL database server. The default is 5432.
DatabaseidentifierName of the database to connect to
UseridentifierUser to connect to the database with
PasswordstringPassword to connect to the database with
ConnectionTimeoutnumberConnection timeout in seconds. The default if not specified is 30 seconds. A value of '0' disables the connection timeout.
ConnectionsnumberMaximum number of simoultaneus database connections (size of connection pool). Default if not specified is 4 connections.
AcquireTimeoutnumberMaximum time allowed to acquire a database connection in seconds
StatementTimeoutnumberThe maximum allowed time to execute a statement in milliseconds.

Table 3.11. SSL configuration settings

NameParameterDescription
SslModeidentifierHow a SSL TCP/IP connection should be negotiated with the server. Possible values and their explanation can be found in the SSL Mode table below.
SslCertfilenameThe file name of the client SSL certificate in case of an SSL connection to the database.
SslKeyfilenameThe file with the secret key used for the client certificate in case of an SSL connection to the database.
SslRootCertfilenameThe File name of the root SSL CA certificate in case of an SSL connection to the database.
SslCRLfilenameThe File name of the SSL certificate revocation list (CRL) in case of an SSL connection to the database.

Table 3.12. SSL modes

NameDescription
disableOnly try a non-SSL connection
allowFirst try a non-SSL connection. If that fails, try an SSL connection
preferFirst try an SSL connection. If that fails, try a non-SSL connection. This is the default.
requireOnly try an SSL connection. If a root CA file is present, verify the certificate.
verify-caOnly try an SSL connection, and verify that the server. The certificate is issued by a trusted CA.
verify-fullOnly try an SSL connection, verify that the server certificate is issued by a trusted CA and that the server hostname matches that in the certificate.

Example configuration

Here follows an example PostgreSQL database configuration:

Database
{
    PostgreSQL
    {
        Identifier        pgdb
        Host              localhost
        Port              5432
        Database          wolframe
        User              wolfusr
        Password          wolfpwd
        ConnectionTimeout 10
        Connections       40
        AcquireTimeout    10
    }
}

3.6.2. Sqlite3

This section explains how to configure a Sqlite database.

Requirements

In order to use an Sqlite3 database in Wolframe you have to configure the loading of the module mod_db_sqlite3 in the LoadModules section of your configuration. The database file configured must have been created before.

Configuration settings

The following table shows the configuration settings for a Sqlite3 database in Wolframe.

Table 3.13. Sqlite3 database configuration settings

NameParameterDescription
IdentifieridentifierDatabase identifier used to reference this database.
FilefilepathStore the SQLite database into the file specified as argument. This parameter is required and the file must have been created before.
ConnectionsnumberNumber of simultaneous connections to the database. Specifies the size of the pool of connections used for database transactions. The default number of connections is 4 if not configured.
ForeignKeysyes or noSetting foreignKeys to yes enables referential integrity in the database. This is actually the same as executing 'PRAGMA foreign_keys=true'. The default is yes.
Profilingyes or noShows the SQL commands being executed and their execution time in milliseconds. Default is no.
ExtensionfilenameLoads the SQLite3 extension module specified as argument. This is useful to load native code into SQLite3 imlementing for instance new database functions. Have a look at the SQLite3 'Run-Time Loadable Extensions' section at http://www.sqlite.org/loadext.html.

Example configuration

Here follows an example Sqlite3 database configuration:

Database
{
    SQLite
    {
        Identifier    sqlitedb
        File          sqlite.db
        ForeignKeys   yes
        Profiling     no
        Connections   3
        Extension     sqlite_module.so
    }
}

3.6.3. Oracle

This section explains how to configure an Oracle database.

Requirements

In order to use an Oracle database in Wolframe you have to configure the loading of the module mod_db_oracle in the LoadModules section of your configuration. The addressed Oracle database server must be running and the database and the user configured must have been created before.

Configuration settings

The following table shows the Oracle database configuration settings:

Table 3.14. Oracle database configuration settings

NameParameterDescription
IdentifieridentifierDatabase identifier used to reference this database.
Hostidentifier or stringAddress of the Oracle database server
PortnumberPort of the Oracle database server, the default is 1521 if not specified
DatabaseidentifierName of the database to connect to, this is the Oracle SID.
UseridentifierUser to connect to the database with
PasswordstringPassword to connect to the database with
ConnectionsnumberMaximum number of simultaneous database connections (size of connection pool)
AcquireTimeoutnumberMaximum time allowed to acquire a database connection in seconds

Example configuration

Here follows an example Oracle database configuration:

Database
{
    Oracle
    {
        Identifier        oradb
        Host              localhost
        Port              1521
        Database          orcl
        User              wolfusr
        Password          wolfpwd
        Connections       10
        AcquireTimeout    10
    }
}