Change database

From DoKSwiki

This is a manual intended for people who would like to change from one database to another. We moved from PostgreSQL to MySQL.

Table of contents

Export your data

If you already have data in your export directory, you could copy this data to a backup directory. Export all your data:

  • ant exportfileformats
  • ant exportusers
  • ant exportscripts
  • ant exportfolders
  • ant exportrecords

Backup your upload directory

Get a copy of the directory where your files are stored

Install new database system

If it isn't installed yet, install a new DBMS.

Create a new database

For MySQL it goes like this:

  • mysql -u root -p
  • GRANT ALL PRIVILEGES ON doks.* TO doks@localhost IDENTIFIED BY 'my_doks_password '; (Grant all privileges to the user doks on a database doks)
  • \q;

Adjust the configuration file

  • You have to adjust the file DOKS_HOME/conf/
  • Uncomment the lines you need (in our case the MySQL section.
  • Adjust the hibernateconnection.url
  • Adjust the hibernate.connection.username
  • Adjust the hibernate.connection.password
  • Put the lines you don't need anymore in comment by pasting a # in front of the lines.
  • Save the file.


  • ant deploy


  • ant schemaupdate

Import the data

  • ant importfileformats
  • ant importusers
  • ant importscripts
  • ant importfolders
  • ant importrecords
  • restart tomcat
note: importing the records could cause problems (e.g. java.lang.OutOfMemory error) because it is a very demanding process. If you experience this problem, try following commands (available from version 1.2.2):
  • ant importrecordsPass1 (this command only imports the records without creating the links between records)
  • ant importrecordsPass2 (this command creates the links between records)
  • restart tomcat

If something goes wrong

In case something goes wrong, you can go back to your other database (don't drop it too soon):

  • Adjust the DOKS_HOME/conf/ to your previous settings
  • Copy the backup of your upload-directory to the right location
  • Ant deploy
  • restart Tomcat