Skip to content

Instantly share code, notes, and snippets.

@archaeogeek
Last active December 4, 2019 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save archaeogeek/6a3732f88e12c48cfa5bf450c6173b63 to your computer and use it in GitHub Desktop.
Save archaeogeek/6a3732f88e12c48cfa5bf450c6173b63 to your computer and use it in GitHub Desktop.
using geonetwork h2 database

Step One:

Find the geonetwork database. This is a file called gn.h2.db but where it lives is dependent on what webserver you are using.

See https://geonetwork-opensource.org/manuals/3.8.x/en/maintainer-guide/installing/configuring-database.html

On windows the path should not have colons in it- eg C:\path\to\database will look like C/path/to/database

Step Two:

Download platform independent zip file from http://www.h2database.com/html/download.html and unblock/extract it

At a command prompt cd to the h2\bin directory

DO NOT USE THE bat OR sh SCRIPTS TO OPEN THE WEB CONSOLE AS IT SEEMS TO CORRUPT THE DATABASE!

Enter the following command:

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

When asked for the URL this will be of the form: jdbc:h2:path/to/gn (not gn.h2 or gn.h2.db)

The generic username is www-data as is the generic password

Note that you may need to shut down geonetwork, and/or delete the additional file gn.lock.db, and/or give write permissions on gn.hd.db

When you successfully connect you will get a prompt like: sql>

See http://www.h2database.com/html/commands.html for command reference.

To view a particular table such as the schemas:

SELECT * FROM SCHEMATRON;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment