Installed Software:
- Java 8
- HSQLDB
- SQLTool
In short, use this image for starting and stopping a simple HSQLDB on your development environment.
$ docker run -d -p 9001:9001 --name hsqldb furbor/hsqldb
Will run hsqldb which will be accessible through jdbc URL: jdbc:hsqldb:hsql://localhost/test, Username: sa, Password :
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'!
SQLTool is a command line client for HSQL: Documentation
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 \
furbor/hsqldb sqltool
The folder /scripts is a Volume with the appropriate user permissions.
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 \
furbor/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
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 \
furbor/hsqldb
Default container user is 'sa' and empty password!
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 \
furbor/hsqldb
The correct JDBC URL is now: jdbc:hsqldb:hsql://localhost/xdb
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 \
furbor/hsqldb
Database hsqldb will be available in folder /opt/database
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 \
furbor/hsqldb
pwd is a Linux directive!
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 \
furbor/hsqldb
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 \
furbor/hsqldb
You will have to use Java 8 parameters: JRE 8 Linux.