8.3Database tools of cmsWorks
cmsWorks is coming with an inbuild memory HSQL database which support to just install the software and just run it. For small content amount and for experimenting it is sufficient. But if placing a cmsWorks into a productive context with unlimited content growth using a separate database is recommended. This than support better performance, scalability, stability and a separate backup strategy.
After an external database is available and a database for cmsWorks is create and a user can connect and has rights to create database tables the cmsWorks database tools come into play.
Every command uses information for the database connect:
host/ip
The host name or IP of the server with the database
port
The port the database can be reached at
databasename
The name of the database for cmsWorks
user
The user name
password
The users password
In the filesystem of the cmsWorks installation change into folder <cmsWorks-installdir>/run/bin/ .
The files setenv.sh (Linux / *ix) or setvars.bat (Windows) declare the correct assignment of the java installation. The same way it is described in Configuring the start script.
The following database handling scripts are available:
dbexecquery.sh
Execute a select-query directly to gather data.
dbexecscript.sh
Executes a sript to be found in the subfolder sqlscripts. Available are initfilldb.script (creates default cmsWorks folder, the standard users and groups) or removeall.script (clear all database tables belonging to cmsWorks)
dbexportimport.sh
This exports the database content from all tables of the cmstables.txt database description into a zip file or imports formerly exported contents into the database after deleting the existing database contents (so use with care).
dbinitcms.sh
Create all database tables. Depeding on the connection protocol the scripts sqlscripts/inithsqldbdb.script, sqlscripts/initmysqldb.script, sqlscripts/initoracledb.script or sqlscripts/initpostgresqldb.script will be executed.
For windows the same scripts are available using the corresponding .bat files. All Scripts show a usage and examples when no parameters are given.
To fill an empty fresh created database with cmsWorks tables use (.sh on Linux / *ix or .bat on Windows)
dbinitcms.sh <connection protocol> <server/ip> <port> <database name> <user> <password>
To initially fill root folder(s), base users, groups and more use
dbexecscript.sh sqlscripts/initfilldb.script <connection protocol> <server/ip> <port> <database name> <user> <password>
After executing "dbinitcms.[sh|bat]" and then "dbexecscript.[sh|bat]" as described, you will have a complete cmsWorks database filled with base credentials but without having any content.
Attention! In case you use MariaDB or MySQL, make sure that the encoding is completely set to UTF-8. You may force this by adding "?useUnicode=true&characterEncoding=utf-8" to the database name in the configuration or while using the database tools.
