0

It is necessary to restore the h2 database. I have a file to recover, but its extension is .db, not .zip. I run h2 through the java -jar ./h2-1.4.190.jar -browser command. In the JDBC URL I indicate: jdbc:h2:file:/opt/backup/my.h2.db . I specify the password and login. The connection is made, I get to the database, but I don’t see my scheme. What should I do?

maksim2112
  • 381
  • 7
  • 21
  • Could you please check this : https://stackoverflow.com/questions/45868946/restore-h2-database because , i think it's a duplicate question – Youssef Tounoussi Nov 07 '19 at 13:38
  • @YoussefTounoussi, This is not a duplicate, because no solution was found in that question. I have a file with the db extension, I do not have a file with the zip extension, as suggested in that answer. – maksim2112 Nov 07 '19 at 13:41

1 Answers1

1

You shouldn't include a file name extension into JDBC URL. The valid URL for such file is jdbc:h2:/opt/backup/my;MV_STORE=FALSE;MVCC=FALSE.

Please note that 1.4.190 is a very old version, use it only if the database was really created with that version. (For the latest version of H2 exclude MVCC setting from the URL, it was removed from H2.)

Use a copy of your file. If it can't be opened normally, use a Recover Tool. https://h2database.com/html/advanced.html#using_recover_tool

Evgenij Ryazanov
  • 6,960
  • 2
  • 10
  • 18
  • Thank you very much!!! I tried to do so: jdbc:h2:file:/opt/backup/my.h2.db, but it was necessary so jdbc:h2:file:/opt/backup/my . Thanks to your help, everything worked! – maksim2112 Nov 07 '19 at 13:46