Code Monkey home page Code Monkey logo

hsqldb's Introduction

Docker Image with HSQLDB for Software Development.

Circle CI Open Issues Stars on GitHub Docker Stars Docker Pulls

Release: blacklabelops/hsqldb:latest

Installed Software:

  • Java 8
  • HSQLDB
  • SQLTool

Make It Short

In short, use this image for starting and stopping a simple HSQLDB on your develeopment environment.

$ docker run -d -p 9001:9001 --name hsqldb blacklabelops/hsqldb

Will run hsqldb which will be accessible through jdbc URL: jdbc:hsqldb:hsql://localhost/test, Username: sa, Password :

Recommended: Docker-Compose! Just curl the files and modify the environment-variables inside the .env-file.

$ curl -O https://raw.githubusercontent.com/blacklabelops/hsqldb/master/docker-compose.yml
$ curl -O https://raw.githubusercontent.com/blacklabelops/hsqldb/master/docker-compose.env
$ docker-compose up -d

docker-compose.env contains a full list of environment variables.

Connect to HSQLDB

The following commands copy the UI-Binaries out of the running container and starts the UI locally:

$ docker cp hsqldb:/opt/hsqldb/hsqldb.jar .
$ java -jar hsqldb.jar

Needs local installation of a Java-JRE!

Inside the UI select "HSQL Database Engine Server" and enter the JDBC URL: jdbc:hsqldb:hsql://localhost/test

Note: When you use boot2docker then enter the ip of your VM instead of 'localhost'!

Use the SQLTool Client

SQLTool is a command line client for HSQL: Documentation

Connect SQLTool from container

Simply start a connected cli by typing:

$ docker exec -it hsqldb bash -c "java -jar /opt/hsqldb/sqltool.jar db"

If you want to mount your script directory, then start a new container:

$ docker run -it --rm \
  --link hsqldb:hsqldb \
	-v $(pwd)/dbscripts:/scripts \
	blacklabelops/hsqldb sqltool

The folder /scripts is a Volume with the appropriate user permissions.

Connect SQLTool from your Host

Boot2Docker: First start the server with the host environment variable:

$ docker run -d --name hsqldb \
	-e "HSQLDB_DATABASE_HOST=192.168.99.100" \
	-p 9001:9001 \
	blacklabelops/hsqldb

The sqltool settings sqltool.rc will now include the correct host.

Execute SQLTool on your host:

# Copy the binaries to your host
$ docker cp hsqldb:/opt/hsqldb .
# Copy settings.rc to your home directory
$ cp ./hsqldb/sqltool.rc ~
# Start sql tool
$ java -jar ./hsqldb/sqltool.jar test

Set Username and Password

You can specify the Username and Password with the environment variables HSQLDB_USER and HSQLDB_PASSWORD.

Example:

$ docker run -d --name hsqldb \
	-e "HSQLDB_USER=sa" \
  -e "HSQLDB_PASSWORD=password" \
	-p 9001:9001 \
	blacklabelops/hsqldb

Default container user is 'sa' and empty password!

Set the Database alias

You can adjust the Database Alias with the environment variable: HSQLDB_DATABASE_ALIAS

This will change the JDBC URL you will have to use!

Example:

$ docker run -d --name hsqldb \
	-e "HSQLDB_DATABASE_ALIAS=xdb" \
	-p 9001:9001 \
	blacklabelops/hsqldb

The correct JDBC URL is now: jdbc:hsqldb:hsql://localhost/xdb

Set the Database Name

You can specify the Database Name with the environment variable HSQLDB_DATABASE_NAME

Example:

$ docker run -d --name hsqldb \
	-e "HSQLDB_DATABASE_NAME=hsqldb" \
	-p 9001:9001 \
	blacklabelops/hsqldb

Database hsqldb will be available in folder /opt/database

Mount the Database Files Externally

The database files are inside the volume /opt/database and can be mounted.

Example:

$ docker run -d --name hsqldb \
	-v $(pwd)/database:/opt/database \
	-p 9001:9001 \
	blacklabelops/hsqldb

pwd is a Linux directive!

Additional HSQLDB Parameters

This container supports the following additional settings:

  • Disable HSQL Trace Modus (do not display JDBC trace messages): HSQLDB_TRACE="false"
  • Enable HSQL Silent Mode (true => do not display all queries): HSQLDB_SILENT="true"
  • Disable HSQL Remote Connections (can open databases remotely): HSQLDB_REMOTE="false"
  • Set HSQL Database Host (for sqltool.rc): HSQLDB_DATABASE_HOST="192.168.99.100"

Example:

$ docker run -d --name hsqldb \
  -e "HSQLDB_TRACE=false" \
  -e "HSQLDB_SILENT=true" \
  -e "HSQLDB_REMOTE=false" \
  -e "HSQLDB_DATABASE_HOST=192.168.99.100" \
  -p 9001:9001 \
  blacklabelops/hsqldb

Java-VM Parameters

You can define start up parameters for the Java Virtual Machine, e.g. setting the memory size.

$ docker run -d --name hsqldb \
	-e "JAVA_VM_PARAMETERS=-Xmx512m -Xms256m" \
	-p 9001:9001 \
	blacklabelops/hsqldb

You will have to use Java 8 parameters: JRE 8 Linux.

Support

Leave a message and ask questions on Hipchat: blacklabelops/hipchat

Maybe no one has ever told you, but munich developers run on beer! If you like my work, share a beer!

BeerMe

References

hsqldb's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.