问题描述
我使用JDBC,并从sql脚本创建了名为usaDB的h2数据库.然后我用jdbc填充了所有表.
问题是我在本地主机上连接到usaDB:8082之后,在左树上看不到我的桌子.仅存在INFORMATION_SCHEMA数据库和我指定的创建usaDB的rootUser
.
如何查看h2数据库中表的内容?
我尝试查询SELECT * FROM INFORMATION_SCHEMA.TABLES
.
但是它返回了许多表名,除了我创建的表名.我的快照:
我遇到了同样的问题,答案似乎确实很愚蠢:键入数据库名称时,您不应添加" .h2.db" "后缀,例如,如果您有数据库文件" D:\ somebase.h2.db ",则连接字符串应类似于" jdbc:h2:file:/D" :/somebase ".通过另一种方式,jdbc创建了一个名为" somebase.h2.db.h2.db "的新的空数据库文件,您将看到:仅系统表.
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 treemy 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:
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.
这篇关于如何在localhost:8082的h2数据库中查看所有表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!