Migrating H2 database

Last modified by Aurelie Bertrand on 2024/07/11 16:52

The H2 database has been updated. Old H2 databases (Comments, DDAudit and DDDataEntry), created on a version prior to 2023R1, are not compatible with this version. You must therefore update them according to the following instructions.

Comments database

To update the Comments database, you can backup the database using the previous version of Digdash Enterprise, and restore it to the new version.

Backup before updating DigDash

  1. From the DigDash home page, go to Configuration then Backup management.
  2. Click the Backup button.
  3. In the login box, enter the user name and password.
    ➡ The Backup page opens.
  4. In the Common server files section,display the files contained in Repository files.
  5. Check the Comments database checkbox.
    CommonServerFiles.png
  6. Click the Export button at the bottom of the window and then the Download the backup file button to get the backup file (.zip file).

Restore after updating DigDash

  1. From the DigDash home page, go to Configuration then Backup management.
  2. Click the Backup button.
  3. In the login box, enter the user name and password.
  4. Click Browse to retrieve the backup file and then click Upload...
    ➡ The Restore page opens.
  5. Check the content and click the Validate button at the bottom of the page.

DDAudit Database

To update the DDAudit database, you must:

  • Perform a migration according to the procedure detailed below.
  • Update the DDAudit module:
    If you have already deployed the module in a previous version, you must redeploy it since the installation of version 2023R1. See page Audit Module Deployment for more information.

Note: the "user" columns of some tables have been renamed to "dd_user".

Before updating DigDash

  1. Stop the Tomcat server.
  2. Locate and backup your current h2 database (for example: DDAudit_ddenterpriseapi.mv.db) to a secure folder.
  3. Save the h2-1.4.195.jar file located in your current webapp folder ddenterpriseapi/WEB-INF/lib to a secure folder.
  4. Export your current database to a SQL file using our h2migrate tool and the old H2 jar file (h2-1.4.195.jar) you saved earlier.
    To do this, in a command prompt, go to the h2migrate.jar file directory <DDInstall>/add-ons/ddaudit and execute the following command:
    • On Linux :
      java -cp "h2migrate.jar:/path/to/h2-1.4.195.jar" com.digdash.tools.h2migrate.H2Export -url
      "jdbc:h2:file:/path/to/DDAudit_ddenterpriseapi" -user sa -password sa -script ddaudit.sql

       
    • On Windows :
      java -cp "h2migrate.jar;/path/to/h2-1.4.195.jar" com.digdash.tools.h2migrate.H2Export -url
      "jdbc:h2:file:/path/to/DDAudit_ddenterpriseapi" -user sa -password sa -script ddaudit.sql

Note : Do not include the .mv.db file extension in the -url parameter.

➡ The ddaudit.sql file is generated in the folder <DDInstall>/add-ons/ddaudit.

  1. Copy it to a secure location.

After updating DigDash

After updating DigDash and restarting the Tomcat server, you have the new version of the H2 file (h2-2.1.214.jar) in your webapp folder ddenterpriseapi/WEB-INF/lib.

  1. Import your current database from the previously generated SQL file using our h2migrate tool and the new H2 jar file (h2-2.1.214.jar).To do this, in a command prompt, go to the h2migrate.jar file directory <DDInstall>/add-ons/ddaudit and execute the following command:
    • On Linux :
      java -cp "h2migrate.jar:/path/to/h2-2.1.214.jar" com.digdash.tools.h2migrate.H2Import -url
      "jdbc:h2:file:/path/to/DDAudit_ddenterpriseapi" -user sa -password sa -script ddaudit.sql
    • On Windows :java -cp "h2migrate.jar;/path/to/h2-2.1.214.jar" com.digdash.tools.h2migrate.H2Import -url
      "jdbc:h2:file:/path/to/DDAudit_ddenterpriseapi" -user sa -password sa -script ddaudit.sql

Note : Do not include the .mv.db file extension in the -url parameter.

DDEntry database

To update the DDEntry database, you must perform a migration according to the procedure detailed below.

Note: the "user" columns of some tables have been renamed to "dd_user".

Before updating DigDash

  1. Stop the Tomcat server.
  2. Locate and backup your current h2 database (for example: DDEntry_ddenterpriseapi.mv.db) to a secure folder.
  3. Save the h2-1.4.195.jar file located in your current webapp folder ddenterpriseapi/WEB-INF/lib to a secure folder.
  4. Export your current database to a SQL file using our h2migrate tool and the old H2 jar file (h2-1.4.195.jar) you saved earlier. To do this, in a command prompt, go to the h2migrate.jar file directory <DDInstall>/add-ons/ddaudit and execute the following command:
    • On Linux :
      java -cp "h2migrate.jar:/path/to/h2-1.4.195.jar" com.digdash.tools.h2migrate.H2Export -url
      "jdbc:h2:file:/path/to/DDEntry_ddenterpriseapi" -user sa -password sa -script ddentry.sql

       
    • On Windows :
      java -cp "h2migrate.jar;/path/to/h2-1.4.195.jar" com.digdash.tools.h2migrate.H2Export -url
      "jdbc:h2:file:/path/to/DDEntry_ddenterpriseapi" -user sa -password sa -script ddentry.sql

Note : Do not include the .mv.db file extension in the -url parameter.

➡ The ddentry.sql file is generated in the folder<DDInstall>/add-ons/ddaudit.

  1. Copy it to a secure location.

After updating DigDash

After updating DigDash and restarting the Tomcat server, you have the new version of the H2 file (h2-2.1.214.jar) in your webapp denterpriseapi/WEB-INF/lib folder.

  1. Import your current database from the previously generated SQL file using our h2migrate tool and the new H2 jar file (h2-2.1.214.jar).To do this, in a command prompt, go to the h2migrate.jar file directory <DDInstall>/add-ons/ddaudit and execute the following command:
    • Sur Linux :
      java -cp "h2migrate.jar:/path/to/h2-2.1.214.jar" com.digdash.tools.h2migrate.H2Import -url
      "jdbc:h2:file:/path/to/DDEntry_ddenterpriseapi" -user sa -password sa -script ddentry.sql
    • Sur Windows :
      java -cp "h2migrate.jar;/path/to/h2-2.1.214.jar" com.digdash.tools.h2migrate.H2Import -url
      "jdbc:h2:file:/path/to/DDAudit_ddenterpriseapi" -user sa -password sa -script ddentry.sql

Note : Do not include the .mv.db file extension in the -url parameter.