2

I'm having trouble opening a h2 database file on Mac OS X. I tried 'DbVisualizer' and 'RazorSQL', but h2 file doesn't open up properly. They show weird characters.

I'm I doing something wrong or is there a better program to open up a h2 database file on Mac?

Q7"�����hQ9! � �!�#�%�'t(])<+%-.�/�0�2�4�5~6a8J:3;<=�?�A�B�C~EgGQH;G!B&QOFF,0,,,falseE2F!B'QOFF,0,,,falseE1D!B ROFF,0,,d,falseE0B B)QOFF,0,,,falseS0,1,2,3,4,5,6,7A!<*QOFF,0,,,falseE1@!<+QOFF,0,,,falseE5>!< ROFF,0,,d,falseE0< <,QOFF,0,,,falseQ0,1,2,3,4,5,6;!5.QOFF,0,,,falseE2:!5/QOFF,0,,,falseE39!5QOFF,0,,,falseE17!5 ROFF,0,,d,falseE05 5QOFF,0,,,falseK0,1,2,34!/QOFF,0,,,falseE13!/QOFF,0,,,falseE21!/ ROFF,0,,d,falseE0/ /QOFF,0,,,falseK0,1,2,3.!(wQOFF,0,,,falseE2-!(xQOFF,0,,,falseE4,!(yQOFF,0,,,falseE1*!( ROFF,0,,d,falseE0( ({QOFF,0,,,falseO0,1,2,3,4,5'! |QOFF,0,,,falseE1&! }QOFF,0,,,falseE2$! ~QOFF,0,,,falseG1,2"!  ROFF,0,,d,falseE0   �QOFF,0,,,falseK0,1,2,3!�QOFF,0,,,falseE4!�QOFF,0,,,falseE3!�QOFF,0,,,falseE2!�QOFF,0,,,falseE1!�QOFF,0,,,falseE6! ROFF,0,,d,falseE0 
wag0325
  • 1,008
  • 5
  • 18
  • 34
  • Instead of trying to open the database file with a file editor, you need to connect to the database using a JDBC URL, for example `jdbc:h2:~/data/test` – Thomas Mueller Jul 11 '14 at 14:06

2 Answers2

3

You can use The Shell Tool, e.g.

java -cp h2*.jar org.h2.tools.Shell

You will be asked for a database URL, JDBC driver, user name, and password. The connection setting can also be set as command line parameters. After connecting, you will get the list of options.

sql> select * from test
...> where id = 0;

For GUI, you can try DBeaver. Check also: Frontend tool to manage H2 database.

On macOS, you can also install h2 via brew install h2, then run h2.

kenorb
  • 155,785
  • 88
  • 678
  • 743
1

Instead of trying to open the database file with a file editor, you need to connect to the database using a JDBC URL, for example jdbc:h2:~/data/test

Thomas Mueller
  • 48,905
  • 14
  • 116
  • 132
  • 2
    It is also very important to omit the extension, otherwise you will see no tables and probably loose 1-2 hours to figure out what's going on :) – maddob May 31 '18 at 14:20