我的H2数据库文件在哪里? [英] Where are my H2 database files?

查看:752
本文介绍了我的H2数据库文件在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是在评估H2数据库...我下载并解压缩安装并连接到数据库 jdbc:h2:file:/ home / konrad / test / home / konrad 是我的家庭目录, test 不存在(我希望H2创建它)。

I'm just evaluating the H2 database... I downloaded and unpacked the installation and connect to a database at jdbc:h2:file:/home/konrad/test. /home/konrad is my home dir, test does not exist (I expect H2 to create it).

控制台似乎工作正常。我创建了一个表并向其插入一行。即使我断开连接并重新连接控制台,我也可以看到并查询该表。

The console seems to work OK. I created a table and inserted a row to it. Even if I disconnect and reconnect the console, I can see and query the table.

但是,我没有看到我预期的文件。在哪里?

However, I don't see the file I expected. Where is it?

推荐答案

你确定没有:

/home/konrad/test.h2.db

file ?如果没有,试试这个:

file? If not, try this:

$ lsof -p `jps -ml | grep h2 | cut -d' ' -f1` | grep \.h2\.db$

它的作用是寻找H2的Java进程console,获取其PID并列出该进程的所有打开文件,按H2数据库扩展进行筛选。当然,您可以使用访问此DB的任何其他Java进程的PID。如果它持久存储在磁盘上,你就不能错过它。

What it does is it look for Java process of H2 console, grabs its PID and lists all open files of that process, filtering by H2 database extension. Of course you can use PID of any other Java process accessing this DB. If it is persisted on the disk, you can't miss it.

这篇关于我的H2数据库文件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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