6

I have installed SQuirreL client to open my file database. I have file named "database.h2.db" and I want to read its content. Well, that's first time I work with database like that. All I need to do is simple change some data in it. I'm not working with Java and not building any project, just edit something in database, probably 1-2 records. So here I am.

Patrik Krehák
  • 2,595
  • 8
  • 32
  • 62
  • duplicate : https://stackoverflow.com/a/19231271/701876 – Benoit Aug 29 '17 at 12:27
  • @Benoit I'm not using Java, but SQuirreL SQL Client. Anyway, I don't need it anymore :) – Patrik Krehák Aug 29 '17 at 20:42
  • 2
    You can use SQuirrel SQL client (http://squirrel-sql.sourceforge.net/) to connect to you H2 database and look at the tables. Create new connection. Select H2 in the driver dropdown menu Set url to your project target folder h2 folder (jdbc:h2:C:\projects\workspace\TestProject\target/h2/database;AUTO_SERVER=true) Enter user name ("sa") Enter password ("") – Benoit Sep 25 '17 at 08:54
  • @Benoit: the title of that question *looks* like a duplicate, yet the actual question, and resulting answer, is about finding the location of the database file. – Wouter Mar 06 '20 at 10:52

1 Answers1

7

First you will need to add the H2 driver to your SQuirrel installation directory. You do this by downloading the h2 jar file here: http://www.h2database.com/html/download.html and copying it to the lib folder of your SQuirrel installation. (At the time of writing the links to the JAR file are broken. You can also download the enire H2 zip file, it includes the jar file somewhere. Named something like h2-1.4.200.jar.

Restart SQuirrel and go to Drivers. There should now be checkmarks next to the H2 options instead of red x'es.

Create an alias, select one of the H2 Drivers (doesn't actually matter wich one). Fill out the URL like this: jdbc:h2:C:\path_to_your\database.h2.db. Set User Name to sa. Connect.

Sidenote: I know OP asked this in 2017. Yet answering for other people looking to do the same.

Wouter
  • 1,829
  • 3
  • 28
  • 34
  • 1
    3 years, a database is lost for a very long time now :) But thanks, hope it will come handy for someone looking for a solution. – Patrik Krehák Apr 04 '20 at 16:28
  • 1
    RE: the sidenote. In fact, it came this came in handy for me in 2020, so yeah, thanks for taking the time. – Chris Walker Sep 19 '20 at 16:29
  • 2
    And it was useful for me in 2020 :) The only thing that I had to change is URL. SQuirreL adds .mv.db at the end, so I had to put url like this: jdbc:h2:C:\path_to_your\database After that change, I was able to access actual DB. Maybe someone will find this info useful in 2023 :) – Matjaz Dec 10 '20 at 08:21