How to check the functionality and corruption of the h2 database

I use the h2 database in native mode with the JavaFX 8 desktop application, and I developed the ability for the user to back up and restore the database file.

In the old version of the program, I used the SQLite database, and checking the database file was pretty simple using this pragma integrity_check command.

Using this command with the h2 database always throws an exception.

What is the alternative to this in the h2 database? And is there an explicit or more correct way to check the h2 database file before using it?

Any help or sample code is appreciated, thanks.

+2
source share
1 answer

What you can do is execute the script to command, for example, during compression. If this command works, the database is good. At the same time, you have a backup.

+1
source

Source: https://habr.com/ru/post/1012548/


All Articles