简体   繁体   English

H2数据库存储在哪里?

[英]Where is the H2 database stored?

I am trying to use an H2 database with Java . 我正在尝试在Java使用H2数据库。 I cannot seem to find out where the data is being written. 我似乎找不到要写入数据的位置。

The database URL I am giving is: jdbc:h2:/db/bh . 我提供的数据库URL是: jdbc:h2:/db/bh

I am connecting with the database using Java like so: 我正在使用Java连接数据库,如下所示:
dbObj.setDBConnection(DriverManager.getConnection(hObj.getDBUrl(), hObj.getDBUsername(), hObj.getDBPassword()));
where DB URL is given above. 上面给出了数据库URL。
Username: sa 用户名:sa
Password: (empty). 密码:(空)。

I am running the jar from within the following folder: 我正在以下文件夹中运行jar
C:\\work\\sampleH2\\sampleH2.jar

My understanding of the FAQ section of H2 says that the database bh will be found in the folder db/ of the folder sampleH2 . 我对H2的FAQ部分的理解是,数据库bh将在sampleH2文件夹的db/文件夹中sampleH2 But that is not the case. 但事实并非如此。 Where can I find it? 在哪里可以找到它?

according to http://www.h2database.com/html/cheatSheet.html there is a difference between storing in: 根据http://www.h2database.com/html/cheatSheet.html ,两者之间存在区别:

  • relative path (somewhere under current directory): jdbc:h2:test 相对路径(当前目录下的某个位置):jdbc:h2:test
  • absolute path (somewhere under root directory): jdbc:h2:/data/test 绝对路径(在根目录下的某个位置):jdbc:h2:/ data / test

so i would look for it on your main drive (probably c:) under path you specified 所以我会在您指定的路径下的主驱动器(可能是c :)上查找它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM