I had the same problem It looks like that former version of h2 traccar used was 1.4.200 and the new one is 2.0.206
and after a lot of try and error I success to install the new version and restore my old h2 database (1.4.200) to the new h2 version (2.0.206) that is the one used by traccar 4.15.
I am not expert at all, and It might be something wrong, but It worked for me.
You need java installed
First of all, before upgrade, you have to make a copy of the old database file, in my case It was in:/op/traccar/data/database.mv.db
Then I downloaded and extracted the h2-1.4.200.jar file from H2 archive downloads version 1.4.200 platform independent zip
I did the same with the h2-2.0.206.jar file from from H2 archive downloads version 1.4.206 platform independent zip
I put them both on the same folder with the backup copy of the database, in my case in C:\temp
After that I did a database backup from old database following the instructions from This link
The command I use wasjava -cp c:\temp\h2-1.4.200.jar org.h2.tools.Script -url jdbc:h2:c:\temp\database -user sa -script test.zip -options compression zip
This creates a zip file named test.zip with a dump of the database
After that I restore the database in 2.0.206 version with this command
java -cp c:\temp\h2-2.0.206.jar org.h2.tools.RunScript -url jdbc:h2:c:\temp\database_new -user sa -script test.zip -options compression zip
After that the database will be created with the name database_new.mv.db.
You have to copy to the database folder on your traccar installation
Stop traccar, delete old version of the file database.mv.db and rename the file database_new_mv.db to database.mv.db
Start traccar, and It should work with all the old data
Had the same db-problem, and also was puzzled how to convert. Beautiful step-by-step instruction catruchos! Was a bit confused that the test.zip file was not shown in the temp-folder, but that didn't affect the end result. Thank you for writing this down!
Thanks catruchos for the detailed instructions.
I was able to update!
catruchos you are a star ! had a nightmare yesterday trying to get traccar to start after the upgrade, your steps worked first time ! thank you : )
Thank you!! This should really have been in the release notes so we know to upgrade db prior to upgrade
You can do it directly from unix part too...
# stop traccar
systemctl stop traccar
# create temp directory for fix
mkdir /opt/FIXH2 ; cd /opt/FIXH2
wget https://h2database.com/h2-2019-10-14.zip
wget https://github.com/h2database/h2database/releases/download/version-2.0.206/h2-2022-01-04.zip
unzip h2-2019-10-14.zip
mv h2 ./h2.2019
unzip h2-2022-01-04.zip
mv h2 ./h2.2022
# find ./ -name "*.jar"
./h2.2022/bin/h2-2.0.206.jar
./h2.2022/service/wrapper.jar
./h2.2019/bin/h2-1.4.200.jar
./h2.2019/service/wrapper.jar
# copy old database file (to fix)
root@DID-Traccar:/opt/FIXH2# cp -p /opt/traccar.4.13/data/database.mv.db /opt/FIXH2
# export database with h2.tools (1.4)
root@DID-Traccar:/opt/FIXH2# java -cp ./h2.2019/bin/h2-1.4.200.jar org.h2.tools.Script -url jdbc:h2:./database -user sa -script backup.zip -options compression zip
# export database from backup.zip to (2.0) with h2.tools
root@DID-Traccar:/opt/FIXH2# java -cp ./h2.2022/bin/h2-2.0.206.jar org.h2.tools.RunScript -url jdbc:h2:./database_new -user sa -script backup.zip -options compression zip
# restore new database file to current traccar data :
root@DID-Traccar:/opt/FIXH2# cp ./database_new.mv.db /opt/traccar/data/database.mv.db
# restart traccar
systemctl start traccar
@Jeremie P this worked perfect!
Thank you
Just to help for copying:
systemctl stop traccar
mkdir /opt/FIXH2
cd /opt/FIXH2
wget https://h2database.com/h2-2019-10-14.zip
wget https://github.com/h2database/h2database/releases/download/version-2.0.206/h2-2022-01-04.zip
unzip h2-2019-10-14.zip
mv h2 ./h2.2019
unzip h2-2022-01-04.zip
mv h2 ./h2.2022
find ./ -name "*.jar"
cp -p /opt/traccar.4.13/data/database.mv.db /opt/FIXH2
java -cp ./h2.2019/bin/h2-1.4.200.jar org.h2.tools.Script -url jdbc:h2:./database -user sa -script backup.zip -options compression zip
java -cp ./h2.2022/bin/h2-2.0.206.jar org.h2.tools.RunScript -url jdbc:h2:./database_new -user sa -script backup.zip -options compression zip
cp ./database_new.mv.db /opt/traccar/data/database.mv.db
systemctl start traccar
Thank you for the linux (and windows) walk through, very helpful.
I had an error extracting the data. This is the error:
org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.IllegalStateException: Unable to read the page at position ...
I am upgrading from Traccar 3.4. I have fixed the error above by using an older version of H2 tools (1.4), specifically this version:
https://h2database.com/h2-2019-03-13.zip
The database is then successfully exported.
Thanks @amibumping - the summary worked a treat
Same issue from 4.1 to 5.6. Zip file is not visible in the folder but works perfectly and solve the problem. Thanks so much.
Hi,
I tried to update to the latest version from the file "traccar-other-4.15.zipper" but when I try to start the server an exception is thrown: