I have downloaded the H2 console from http://www.h2database.com/html/download.html
and I have configured the URL in my jdbc.properties
file
to jdbc:h2
Had the same Problem.
This solved it for me: Why is my embedded h2 program writing to a .mv.db file
Just added ;MV_STORE=FALSE
and ;MVCC=FALSE
to the jdbc url and everything worked just fine.
You can also avoid this problem by using the same version between H2 console and your Java code.
This is how I solved this same issue here.
I have used the below and I see my table get created.
spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE
spring.h2.console.enabled=true
spring.h2.console.path=/h2console
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driverClassName=org.h2.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
Based on your question, it doesn't look like you fell victim to this particular pitfall, but this thread ended up helping me nail down the issue, so I am recording the solution here for posterity since it may help others with the same problem.
I also found that when I tried to open my database with the H2 console that I got what appeared to be a blank H2 database (basically, just an INFORMATION_SCHEMA table). While double-checking that I got the name of the DB correct (mydb.mv.db
), I discovered that the H2 console had created a second database file, mydb.mv.db.mv.db
. Odd.
It turns out that the H2 Console expects you to omit the suffix .mv.db
from the filename. Since I hadn't, it was looking for mydb.mv.db.mv.db
. Changing the JDBC string to jdbc:h2:mydb
solved the problem and I could then open the file from the H2 Console.
This is how you enable memory enable database using h2 module. You need to ensure the following things
spring.h2.console.enabled=true
localhost:8080/h2-console
JDBC URL:
-> jdbc:h2:mem:testdb
5.Hit the connection buttonSalam
Add Annotation @EntityScan("packageName") in main class