Corrupted Database

309 views
Skip to first unread message

Felipe Santos

unread,
Nov 18, 2020, 4:02:22 PM11/18/20
to H2 Database
Hello.

I'm new to this group and to working with H2 database in general. 
I'm currently doing a internship in my college and I encountered an error but after much searching on the internet I couldnt find any solutions.

It all started after I stopped the execution (java run) on eclipse of my program, I believe it was running the INSERT query for a lot of data in H2 and it may have corrupted the database.

this is the error I encounter on eclipse:
2020-11-18 16:56:52.632  INFO 17636 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2020-11-18 16:56:55.746 ERROR 17636 --- [  restartedMain] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception during pool initialization.

org.h2.jdbc.JdbcSQLException: General error: "java.lang.NullPointerException" [50000-196]

if I leave it running, it tries again, and then this error appears:

2020-11-18 16:56:55.751  WARN 17636 --- [  restartedMain] o.s.b.a.orm.jpa.DatabaseLookup           : Unable to determine jdbc url from datasource

org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.h2.jdbc.JdbcSQLException: General error: "java.lang.NullPointerException" [50000-196]


I have tried
1. deleting all files under C:\Users\<myUser>\.m2\repository\com\h2database\h2\1.4.196
2. On eclipse, maven clean and maven install
3. On eclipse, java run
4. !same error

I also have tried running the h2-1.4.196.jar , entering the console on the browser and runnning the recovery tool, but it returns the following error:

Error: java.lang.IllegalStateException: Unsupported type 17 [1.4.196/3] 
 
I don't know what else to try.

Andreas Reichel

unread,
Nov 19, 2020, 4:59:30 AM11/19/20
to h2-da...@googlegroups.com
Good Morning Felipe,

from your e-mail, I can't see any H2 specific issues, only warnings related to the abstraction layers Hikari (the connection pool) and JPA (Pojo persistence).
My advice is: forget about these in a first step and open the H2 database directly via the integrated H2 Web Console:

1) start the H2 database: java -jar h2.jar
2) open the Web Console in your browser (should be started automatically already)

There, open your particular H2 database file and maybe export it to SQL Script or Shutdown Defrag it.
If that works, then there is nothing wrong with your database.

If that does not work, you might want to try the Recovery Tool (although this has never worked for me and my cases of H2 database corruption).

Good luck!
Andreas
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/h2-database/97d85d62-1973-4fed-8a06-ce2307a32459n%40googlegroups.com.

Andreas Reichel

unread,
Nov 19, 2020, 5:03:59 AM11/19/20
to h2-da...@googlegroups.com
Error: java.lang.IllegalStateException: Unsupported type 17 [1.4.196/3] 

Based on that message, I believe the H2 database has been created with a H2 version different from 1.4.196.
Please try to open the Database exactly with the H2 version it has been created with.

If you want to migrate to a different H2 version, export to SQL script and create a new database from the SQL script.

Best regards
Andreas

Reply all
Reply to author
Forward
0 new messages