Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access *.mv.db file of H2 database?

I have created database with my own program and it appeared as mydatabase.mv.db file.

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.

What was the incompatibility?

UPDATE

both setups are follows:

enter image description here

enter image description here

like image 797
Suzan Cioc Avatar asked Nov 24 '14 00:11

Suzan Cioc


People also ask

How do I access my H2 database file?

Connect to the embedded H2 database using the H2 console Alternatively you can connect using the browser based H2 console. The easiest way to access the console is to double click the H2 database jar file at <installation-directory>\confluence\WEB-INF\lib\h2-x.x.x.jar .

Where is H2 DB stored?

And in case it's not obvious, on Linux/MacOSX systems the H2 database files are stored under the path in the JDBC URL, so ~/test would be found at $HOME/test.

How can I recover data from H2 database?

H2 Console By default, the console view of the H2 database is disabled. Before accessing the H2 database, we must enable it by using the following property. Once we have enabled the H2 console, now we can access the H2 console in the browser by invoking the URL http://localhost:8080/h2-console.

What is Keycloak MV DB?

What is Keycloak. mv. db? Keycloak, an open source identity and access management solution our Broker utilizes, comes with its own embedded Java-based relational database called H2. This database, keycloak.


2 Answers

In H2 version 1.3.x, the database file <databaseName>.h2.db is the default. (The storage engine "PageStore" is used).

In H2 version 1.4.x, the database file <databaseName>.mv.dbis 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.

like image 71
Thomas Mueller Avatar answered Oct 24 '22 00:10

Thomas Mueller


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.html and 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.

Also, make sure you remove .mv.db from the file name when setting the Database file name in DBVizualizer.

like image 29
Tom Bollwitt Avatar answered Oct 24 '22 00:10

Tom Bollwitt