Upgrading H2 Database
The H2 database format has been changed in H2 version 1.2.130 which requires additional manual steps for the
To create a script backup of your current database use the following command:
java -cp ../lib/h2-1.2.128.jar org.h2.tools.Script -url jdbc:h2:AddressBookDB -user sa -script ABS.zip -options compression zip
And to restore the database after installing the new release use this command:
java -cp ../lib/h2-1.2.131.jar org.h2.tools.RunScript -url jdbc:h2:AddressBookDB -user sa -script ../olddb/ABS.zip -options compression zip
The same process can also be used for database recovery after power failures etc.
Dealing with database corruption
From time to time it can occur that the database has become corrupt. In this case the Script tool described above fails to export the database correctly. When this happens the Recover tool can be used to generate a flat file export of the entire database. The following example illustrates the recovery process.
The following error message "org.hibernate.exception.GenericJDBCException: could not execute query" indicates that the integrity of the database is no longer intact and should be recovered using the process described here.
First stop your Address Book Server. Stopping instructions
Use the recover tool as shown where from inside the db folder
cd /usr/share/addressBookServerEnterpriseEdition/apache-tomcat-6.0.24/db java -cp ../lib/h2-1.2.128.jar org.h2.tools.Recover
This produces a flat text file containing all the SQL statements which make up the entire database. It is best to create a new empty directory (../newdb) into which the new database is restored. Then run the command shown below to generate a new database from the previously exported script (AddressBookDB.h2.sql).
mkdir ../newdb
java -cp /usr/share/addressBookServerEnterpriseEdition/apache-tomcat-6.0.24/lib/h2-1.3.149.jar org.h2.tools.RunScript
-url jdbc:h2:../newdb/AddressBookDB -user recovery -script AddressBookDB.h2.sql
Once the database has been re-generated, simply replace the old db folder with the new one using the following commands.
cd .. mv db olddb mv newdb db
Now restarted your Address Book Server. Starting instructions
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)