Migrating between H2 databases

The WebSphere®® Liberty server for running samples uses the H2 database. The database comes with preconfigured versions of the Rule Execution Server console, and the Decision Center web applications. They include populated databases and predefined users.

Operational Decision Manager supports H2 2.x. If you are using H2 1.x, you must manually export the contents of the older database, and then import them into the new database.

Note:

To have Rule Execution Server and Decision Runner work properly in H2 2.x, you need to include the NON_KEYWORDS=VALUE flag in your jdbc/resdatasource connection definition, for example:

jdbc:h2:/path/to/your/database/resdb;NON_KEYWORDS=VALUE

To migrate your data:

  1. Use an H2 1.x h2.jar runtime to back up your database as an SQL script:
    java -cp h2.jar org.h2.tools.Script -url "jdbc:h2:file:<path to the database>" -user dbuser -password dbpassword -script <path where the sql script is saved>

    For example:

     java -cp h2.jar org.h2.tools.Script -url "jdbc:h2:file:/path/to/your/h2V1/database/resdb" -user dbuser -password dbpassword -script /temporary/location/backup.sq
  2. Use an H2 2.x h2.jar with the backup.sql script from the first step and run the following command:
    java -cp h2.jar org.h2.tools.RunScript -url "jdbc:h2:file:<path to the database>;NON_KEYWORDS=VALUE" -user dbuser -password dbpassword -script <path where the sql script was saved>

    For example:

    java -cp h2.jar org.h2.tools.RunScript -url "jdbc:h2:file:/path/to/your/h2V2/database/resdb;NON_KEYWORDS=VALUE" -user dbuser -password dbpassword -script /temporary/location/backup.sql

The command imports your data into the newer database.