Java Programming Tutorials

Java programming tutorials with many code examples!

HSQLDB Database Manager

Problem:

How to start HSQLDB Database Manager?

Solution:

The Database Manager is part of HSQLDB and is contained in its JAR. So, if you use the DB in your project and downloaded JARs using Maven, then you can use the following script to automatically start the newest Database Manager:

#!/bin/bash
HSQLDB_CLASSPATH=$(find ~/.m2/repository/ -name '*hsqldb-*[0-9].jar' -type f | sort -r | head -1)
if [ -z "${HSQLDB_CLASSPATH}" ]; then
    echo "Can't find HSQLDB jar in ~/.m2/repository."
else
    java -cp "${HSQLDB_CLASSPATH}" org.hsqldb.util.DatabaseManagerSwing
fi

The script is searching ~/.m2/repository for all HSQLDB JARs and selects the one with the highest number, so the newest one.

Share with the World!