How to see all tables in my h2 database at localhost:8082?

Volodymyr Levytskyi picture Volodymyr Levytskyi · May 1, 2014 · Viewed 75.9k times · Source

I use JDBC and created h2 database called usaDB from sql script. Then I filled all tables with jdbc.

The problem is that after I connect to usaDB at localhost:8082 I cannot see on the left tree my tables. There is only INFORMATION_SCHEMA database and rootUser which I specified creating usaDB.

How to view the content of tables in my h2 database?

I tried query SELECT * FROM INFORMATION_SCHEMA.TABLES.

But it returned many table names except those I created. My snapshot:

enter image description here

Answer

Le_Enot picture Le_Enot · Jan 13, 2015

I had the same issue and the answer seems to be really stupid: when you type your database name you shouldn't add ".h2.db" suffix, for example, if you have db file "D:\somebase.h2.db" your connection string should be like "jdbc:h2:file:/D:/somebase". In other way jdbc creates new empty database file named "somebase.h2.db.h2.db" and you see what you see: only system tables.