为什么在打开H2控制台时看不到Java添加的表? [英] Why are added tables from Java not visible when I open the H2 console?

查看:320
本文介绍了为什么在打开H2控制台时看不到Java添加的表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Java的H2嵌入式数据库,在创建数据库并添加了一些表和数据后,将其另存为文件在我计算机的目录中。

I use an H2 embedded database in Java, and after creating the database and adding some tables and data, it gets saved as a file in a directorey of my computer.

但是无论何时我使用H2控制台打开此文件,它根本不显示任何表吗?为什么表不存在?

But whenever I open this file with the H2 Console, it shows no tables at all? Why are the tables not there?

我在Java代码中使用以下URL: jdbc:h2:file:// C:/ Temp / H2 / ourDB

I am using this URL in my java code: jdbc:h2:file://C:/Temp/H2/ourDB

然后我使用以下信息登录控制台:

And I log into the console with the following information:

登录后,看不到用Java创建的表吗?

After logging in, I can't see the tables that were created in Java?

推荐答案

您在H2控制台中使用了其他数据库URL(不是 jdbc:h2:file:// C:/ Temp / H2 / ourDB ) 。您需要使用相同的数据库,否则将使用不同的数据库。

You have used a different database URL in the H2 Console (not jdbc:h2:file://C:/Temp/H2/ourDB). You need to use the same one, otherwise it's a different database.

这篇关于为什么在打开H2控制台时看不到Java添加的表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆