Skip to main content Skip to complementary content

Upgrading the H2 database from 1.x to 2.x version

The H2 database driver is upgraded to version 2.1.210, following CVE issues. The database built by driver version 1.4.196/1.4.200 is not compatible with version 2.1.210. To upgrade the database, you need to backup the database with the old H2 driver and restore this backup on the new driver.

Procedure

  1. Prepare the database drivers:
    • The old one (h2-1.4.196.jar/h2-1.4.200.jar).
    • The new one (h2-2.1.210.jar).
  2. Backup the database using the Script tool:
    // use the h2-1.4.196.jar/h2-1.4.200.jar to backup the current h2 db:talend_administrator to file: tac_backup.zip
    java -cp .\h2-1.4.200.jar org.h2.tools.Script -url 
    "jdbc:h2:file:D:/Tomcats/tacdb/migrate/talend_administrator;MV_STORE=FALSE;AUTO_SERVER=TRUE;lock_timeout=15000;DEFAULT_LOCK_TIMEOUT=15000;LOCK_MODE=0" 
    -user tisadmin -password tisadmin -script tac_backup.zip -options compression zip
  3. Restore the backup to the new database using the RunScript tool:
    // use the h2-2.1.210.jar to restore the backup file: tac_backup.zip to new db: talend_administrator_new
    java -cp .\h2-2.1.210.jar org.h2.tools.RunScript -url 
    "jdbc:h2:file:D:/Tomcats/tacdb/migrate/talend_administrator_new;AUTO_SERVER=TRUE;lock_timeout=15000;DEFAULT_LOCK_TIMEOUT=15000;LOCK_MODE=0;MODE=LEGACY" 
    -user tisadmin -password tisadmin -script tac_backup.zip -options compression zip
  4. Update the talend_administrator_new.mv.db file name to talend_administrator.mv.db. Talend Administration Center will use this new file which works with the 2.1.210 driver.
    Also update <ApplicationPath>/WEB-INF/classes/configuration.properties file with the correct JDBC URL:
    jdbc:h2:{0}/WEB-INF/database/talend_administrator;AUTO_SERVER=TRUE;lock_timeout=15000;DEFAULT_LOCK_TIMEOUT=15000;LOCK_MODE=0;MODE=LEGACY
    For more information on how to upgrade, backup, and restore the H2 database, see https://h2database.com/html/tutorial.html#upgrade_backup_restore.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!