Java 如何访问H2数据库的*.mv.db文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27096363/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to access *.mv.db file of H2 database?
提问by Suzan Cioc
I have created database with my own program and it appeared as mydatabase.mv.db
file.
我用我自己的程序创建了数据库,它显示为mydatabase.mv.db
文件。
But when I tried to access the same database with DbVisualizer
, with apparently same parameters, it created two files mydatabase.lock.db
and celebrity.h2.db
and didn't see tables, created in the program.
但是当我尝试DbVisualizer
使用显然相同的参数访问同一个数据库时,它创建了两个文件mydatabase.lock.db
,celebrity.h2.db
并且没有看到在程序中创建的表。
What was the incompatibility?
什么是不兼容?
UPDATE
更新
both setups are follows:
两种设置如下:
采纳答案by Thomas Mueller
In H2 version 1.3.x, the database file <databaseName>.h2.db
is the default. (The storage engine "PageStore" is used).
在 H2 版本 1.3.x 中,数据库文件<databaseName>.h2.db
是默认的。(使用存储引擎“PageStore”)。
In H2 version 1.4.x, the database file <databaseName>.mv.db
is the default. (The storage engine "MVStore" is used). The MVStore is still beta right now (November 2014). But you can disable the MVStore by appending ;mv_store=false
to the database URL.
在 H2 版本 1.4.x 中,数据库文件<databaseName>.mv.db
是默认的。(使用存储引擎“MVStore”)。MVStore 目前仍处于测试阶段(2014 年 11 月)。但是您可以通过附加;mv_store=false
到数据库 URL来禁用 MVStore 。
回答by Tom Bollwitt
The accepted answer is now several years old and since others may be looking for a more "current" solution...
接受的答案现在已经有好几年了,因为其他人可能正在寻找更“当前”的解决方案......
To get it to work just update the H2 JDBC driver that DBVizualizer uses. Basically download the "Platform-Independent Zip" from http://www.h2database.com/html/download.htmland copy the h2/bin/h2-X.X.X.jar
file to ~/.dbvis/jdbc/
and then restart DBVizualizer so it can pick up the updated driver.
要使其工作,只需更新 DBVizualizer 使用的 H2 JDBC 驱动程序。基本上从http://www.h2database.com/html/download.html下载“Platform-Independent Zip”并将h2/bin/h2-X.X.X.jar
文件复制到~/.dbvis/jdbc/
然后重新启动 DBVizualizer 以便它可以选择更新的驱动程序。
Also, make sure you remove .mv.db
from the file name when setting the Database file name in DBVizualizer.
此外,请确保.mv.db
在 DBVizualizer 中设置数据库文件名时从文件名中删除。