Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing and starting the H2 database on Ubuntu

Tags:

h2

I would like to use the H2 database on Ubuntu 12.10, and went to the website and got the platform independent install file.

The installation instructions are quite literally, "To install the software, run the installer or unzip it to a directory of your choice."

I'm not a Linux novice, so I've used many of the usual install procedures before, but I have no idea what I am supposed to do here. There are no configure or makefiles that I can find, and the documentation doesn't mention anything, and there I can't find anything using google.

I don't know if I am missing something obvious. Can anybody help please?

like image 915
Mustafa Doe Avatar asked Sep 02 '13 14:09

Mustafa Doe


People also ask

How do I access H2 database in Linux?

Access the H2 Console You can access the console at the following URL: http://localhost:8080/h2-console/. You need to enter the JDBC URL, and credentials. To access the test database that the greeter quickstart uses, enter these details: JDBC URL: jdbc:h2:mem:greeter-quickstart;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1.

How do I access my H2 memory database?

To access an in-memory database from another process or from another computer, you need to start a TCP server in the same process as the in-memory database was created. The other processes then need to access the database over TCP/IP or TLS, using a database URL such as: jdbc:h2:tcp://localhost/mem:db1 .


2 Answers

A shell script to start the H2 server and browser GUI is included. I don't have Ubuntu right now, but the steps should be:

  • Download the H2 zip file (for example h2-2013-07-28.zip).
  • Open a terminal window

And then run:

cd <download directory>
unzip h2*.zip
cd h2/bin
chmod +x h2.sh
./h2.sh

This should start the H2 server tool and open a browser window that lets you connect to a database.

The content of the h2.sh script is relatively simple, it is:

#!/bin/sh
dir=$(dirname "$0")
java -cp "$dir/h2-1.3.173.jar:$H2DRIVERS:$CLASSPATH" org.h2.tools.Console "$@"

What you can also do is double click the h2*.jar file (if double click is configured to start java), or run this on a command line:

java -jar h2-1.3.173.jar
like image 104
Thomas Mueller Avatar answered Oct 23 '22 02:10

Thomas Mueller


Download h2 from here http://www.h2database.com/h2-2015-01-16.zip, then once the download has completed, unzip in home directory and run the following:

 cd (directory path ).
 cd h2/bin.
 chmod +x h2.sh.
 ./h2.sh.
like image 36
NewUser Avatar answered Oct 23 '22 02:10

NewUser