Migration to H2 Database version 2.2.224
A new InformixHQ version 2.4.1 is released which uses H2 Database version 2.2.224 .
Two options for migration to H2 Database version 2.2.224 are explained below:
1. Old InformixHQ (version between 2.1.0 to 2.3.3) where old jar file should be available:
- Take a backup of the directory $INFORMIXDIR/hq to ${OLDHQDIR}.
- Copy the jar files to $INFORMIXDIR/hq.
Unable to start the InformixHQ server as the H2db version is older and needs an upgrade. Please run below command to upgrade H2db to newer version.
java -cp ${NEWHQDIR}/informixhq-server.jar com.informix.hq.server.h2.upgrade.H2UpgradeV2 ${OLDHQDIR}/informixhq-server.jar
OR
java -cp ${NEWHQDIR}/informixhq-server.jar com.informix.hq.server.h2.upgrade.H2UpgradeV2 ${OLDHQDIR}/informixhq-server.jar ${PROPERTIES_DIR}/informixhq-server.properties
- Path of the old InformixHQ server jar (version between 2.1.0 and 2.3.3) should be known and should be supplied where {OLDHQJAR} is referenced in the command above.
- If {OLDHQJAR} jar path is not available, then this upgrade needs to be completed using a few manual steps. Please refer Section 2 below.
- Second parameter Path of the properties file is optional. If any of the H2 Database properties (encrypt.enable, encrypt.algorithm, encrypt.password) is set previously, then this should be supplied where {PROPERTIES_DIR} is referenced in the command above.
- Current directory should contain old H2 Database file (h2db.mv.db).
- {NEWHQJAR} referenced above is the current InformixHQ (2.4.0 or higher) jar path. Default InformixHQ jar path is {INFORMIXDIR}\hq\
- Ensure old h2db.mv.db has correct file permission for InformixHQ jar to access the same.
- Successful execution of above command with required parameters will give the following output:
Backup of old h2db file is completed successfully, now backup h2db file name is h2db_old_v2.mv.db. Data export process executed successfully. Data import process executed successfully. Clean-up for import and export process completed successfully.
2. If Old InformixHQ (1.6.3 or lower) jar path NOT available:
In this case, manual steps given below need to be followed for H2 Database upgrade and migration:
- Prerequisites for manual upgrade:
In order to migrate from H2 Database 2.1.x to 2.2.x, , both versions of H2 Database are needed.
Download the jars version 2.2.224 (h2-2.2.224.jar) and version 2.1.214(h2-2.1.214.jar) from H2 site or from maven repository https://mvnrepository.com/artifact/com.h2database/h2
Ensure that the downloaded H2 jar files have appropriate file permissions for migration process. If any of the commands given below fails, migration can be started again with backup taken in step 1 below.
Software Required Version h2-2.1.214.jar 2.1.214 h2-2.2.224.jar 2.2.224 Java 11 - Procedure:Follow these steps to migrate the H2 Database:
- Backup existing database
Find the existing H2 Database (h2db.mv.db).
For InformixHQ, database can be found at <installation_Path>/explore/server/h2db.mv.db
By default, InformixHQ installation path is $INFORMIXDIR/hq
H2 Database file name is h2db.mv.db.
Make a copy of h2db.mv.db to some other directory for backup before starting the migration.
- Export data to a zip file.
Open a command line window in the path where H2 Database file is present and run the java command. Replace <h2_path> with the path where h2-2.1.214.jar is present.
- If H2 Database encryption is NOT enabled in InformixHQ properties
file:
java -cp <h2_path>/h2-2.1.214.jar org.h2.tools.Script -url "jdbc:h2:./h2db" -script h2db.zip -options compression zip
- If H2 Database encryption is Enabled in InformixHQ properties file:
If h2.encrypt.enable, h2.encyrpt.password, and h2.encrypt.algorithm parameters are set in InformixHQ server properties file, then the commands will be modified as shown below.
Example: If h2.encrypt.enable=true, h2.encyrpt.password=password123, and h2.encrypt.algorithm= AES, H2 Database URLs should be modified as shown below:
(Add a space after the password since the format is <file_password> space <user_password>)
java -cp <h2_path>/h2-2.1.214.jar org.h2.tools.Script -url "jdbc:h2:./h2db;CIPHER=AES" -password "password123 " -script h2db.zip -options compression zip
- If H2 Database encryption is NOT enabled in InformixHQ properties
file:
- Rename the existing H2 Database.
Rename the existing H2 Database, h2db.mv.db.
mv h2db.mv.db h2db_old.mv.db
- Inport data from the zip file.
Run the following java command to create a new H2 Database file (h2db.mv.db) and to restore data from zip file created in step 3. Replace <h2_path> with the path where h2-2.2.224.jar is present.
- If H2 Database encryption is NOT enabled in InformixHQ properties
file:
java -cp <h2_path>/h2-2.2.224.jar org.h2.tools.RunScript -url "jdbc:h2:./h2db" -script h2db.zip -options compression zip
- If H2 Database encryption is Enabled in InformixHQ properties file:
If h2.encrypt.enable, h2.encyrpt.password, and h2.encrypt.algorithm parameters are set in InformixHQ server properties file, then the commands will be modified as shown below.
Example : If h2.encrypt.enable=true, h2.encyrpt.password=password123, and h2.encrypt.algorithm= AES, H2 Database URLs should be modified as shown below:
(Add a space after the password since the format is <file_password> space <user_password>)
java -cp <h2_path>/h2-2.2.224.jar org.h2.tools.RunScript -url "jdbc:h2:./h2db;CIPHER=AES" -password "password123 " -script h2db.zip -options compression zip
Once all the above steps are completed without any error, data is successfully migrated to h2db.mv.db.
- If H2 Database encryption is NOT enabled in InformixHQ properties
file:
- Cleanup Migration files (Optional)
At this point h2db.zip, h2db_old.mv.db files can be deleted.
- Backup existing database
If you are upgrading InformixHQ from version 1.6.3 or below, follow the steps given at Migration to H2 Database version 2.1.214 before following the instructions given above.