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:
Accessing H2 Console. Start the spring boot application and access the console in the browser with this URL : http://localhost:8080/h2 . We can see the console like this. Now enter the configured username and password.
If you started the server on the same computer as the browser, open the URL http://localhost:8082 . If you want to connect to the application from another computer, you need to provide the IP address of the server, for example: http://192.168.0.2:8082 .
All Database Tables If you want to list all tables in the Oracle database, you can query the dba_tables view. SELECT table_name FROM dba_tables ORDER BY table_name ASC; This view (and all others starting with dba_) are meant for database administrators.
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.
You can use the SHOW
command:
Using this command, you can lists the schemas, tables, or the columns of a table. e.g.:
SHOW TABLES
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With