Jan
Jan

Reputation: 43169

h2 database: Unsupported database file version or invalid file header in file

As the title reads, I am trying to open a .h2.db file using DataGrip on MacOS. However, I keep getting the error

Unsupported database file version or invalid file header in file

With the error code

[90048-192]

How do I check the actual database file version and how to get the correct driver files(?) ?

Upvotes: 12

Views: 18088

Answers (4)

searching9x
searching9x

Reputation: 1605

I had the same issue when I downgrading Spring Boot version. Try restore Spring Version back to original.

Upvotes: 0

Sven Döring
Sven Döring

Reputation: 4368

I had this error with a persistent TCP H2 database.

After updating the H2 version, the old persisted database file still existed.

I had to delete the old database file to get rid of the error.

My Error Code was [90048-214].

Upvotes: 4

mnagdev
mnagdev

Reputation: 514

For me, the problem was with the JDBC URL in the h2 login screen. It was a random URL and after I changed it to the spring.datasource.url value I had set in my application.properties, it started working.

enter image description here

Upvotes: 2

actc
actc

Reputation: 682

Try to connect with a database tool like SQuirreL to your database and execute SELECT H2VERSION() FROM DUAL or select value from information_schema.settings where name = 'info.VERSION'; to get the actual version.

Maybe this link on how to upgrade a h2 database can also be helpful: How to check if a h2 database needs to be upgraded?

One more thing: your database could be corrupted. You could try to recover the data by using the recovery tool http://www.h2database.com/html/advanced.html#using_recover_tool or to check the database on corruption How to check h2 database health and corruption

Upvotes: 0

Related Questions