3.3.3The database connection service

All content entered or uploaded into cmsWorks is stored in a database, this chapter describes how the parameters have to be configured so that the database is accessible for the CMS.

The service "CMSDB" manages a connection pool that holds connections to the configured database.

Property file and property key paths are:

Service properties file

<cmsWorks-installdir>/run/properties/database.properties

Service property key paths

/com/topasworks/kernel/service/database/CMSDB/

 

Entry

Value

Description

JDBCKey

jdbc:mysql

for MariaDB / MySQL

DatabaseName

cmsdb

The MariaDB / MySQL-name of the database

HostName

127.0.0.1

IP or host name of the db-server-machine

User

dbuser1

Username of the database (dbuser1 is an example)

Password

secretpw

Password of the database user (secretpw is an example)

Port

3306

Port the database listens to

MinConnections

4

The minimum count of connections that are established when starting the Database service, this value should be 4 or higher.

MaxConnections

20

The maximum count of connections that can be created while using the Database service. When using the Database service in multiple Threads (Parallel processing in JAVA) and the maximum count of connections has been reached, the next Thread has to wait until a connection is not in use any more.

AutoCommit

0

cmsWorks handles itself transactional behavior in the database and commits the changes when done, so AutoCommit is set to "false".

PingInterval

5000

Established connections to the database may be closed from the database side. So this is the time in milliseconds after that the Database service will send a connection keep alive query.

PingSelect

SELECT MIN(1) FROM DUALS

This is the query to keep alive the established database connections, the table DUALS exists in cmsWorks databases.

ConnectionTrace

0

JDBC connection tracing is turned off in cmsWorks by default.

Here is a full example of the Database service configuration:

# ###################################################################################
# 
# Properties for the cms database service
#
# ###################################################################################
# service create /com/topasworks/kernel/service/database,DatabaseService,CMSDB

/com/topasworks/kernel/service/database/CMSDB/StartTimeout=10000
/com/topasworks/kernel/service/database/CMSDB/StopTimeout=10000
/com/topasworks/kernel/service/database/CMSDB/AccessTimeout=5000
/com/topasworks/kernel/service/database/CMSDB/StopInformExtern=1

/com/topasworks/kernel/service/database/CMSDB/JDBCKey=jdbc:mysql
/com/topasworks/kernel/service/database/CMSDB/Port=3306
/com/topasworks/kernel/service/database/CMSDB/DatabaseName=cmsdb
/com/topasworks/kernel/service/database/CMSDB/HostName=127.0.0.1
/com/topasworks/kernel/service/database/CMSDB/User=dbuser1
/com/topasworks/kernel/service/database/CMSDB/Password=secretpw

/com/topasworks/kernel/service/database/CMSDB/MinConnections=1
/com/topasworks/kernel/service/database/CMSDB/MaxConnections=10
/com/topasworks/kernel/service/database/CMSDB/AutoCommit=0
/com/topasworks/kernel/service/database/CMSDB/PingInterval=5000
/com/topasworks/kernel/service/database/CMSDB/PingSelect=SELECT MIN(1) FROM DUALS
/com/topasworks/kernel/service/database/CMSDB/ConnectionTrace=0

Configuration example of the Database service

In case you set the parameters correctly the database service can be started using the telnet server shell (if the database service is running "service restart CMSDB", otherwise simply use the command "service start CMSDB") or restart the cmsWorks-server so that it starts the service on its own.

In case the parameters are not correct an error message on the console will be printed which indicates the configuration error.