16

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

Neil Stockton
  • 10,922
  • 3
  • 30
  • 28
Suzan Cioc
  • 27,971
  • 54
  • 206
  • 370

2 Answers2

21

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.

Thomas Mueller
  • 47,133
  • 13
  • 106
  • 128
  • i can confirm the `1.4.190` version of h2 will create a `.h2.db` instead of `.mv.db`(even i set `MVCC=TRUE;MULTI_THREADED=TRUE` in jdbc url). what i have to do is set `MC_STORE=TRUE` to force h2 use `.mv.db` file. – bob Dec 03 '15 at 09:42
  • I think you are using an older version 1.4.190, or the database already existed. Could you check by running `select * from information_schema.settings where name like '%BUILD%'`? With version 1.4.190 you will get `190` twice as the result (`CREATE_BUILD` is the build that was used to create the database, and `info.BUILD_ID` is the current version). By the way it is `MV_STORE` not `MC_STORE`. – Thomas Mueller Dec 04 '15 at 08:22
  • 1
    sorry, i find out it was caused by the database has been created before(without MVCC=TRUE). if the `.h2.db` exist, it seems h2 will reuse the older one rather create new one called `.mv.db`. – bob Dec 05 '15 at 08:39
  • 1
    Yes if a database (created by an older version) already exists, it is used. – Thomas Mueller Dec 06 '15 at 13:45
7

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.

Tom Bollwitt
  • 10,619
  • 1
  • 16
  • 11