Search code examples
hsqldbubuntu-20.04ubuntu-22.04

HSQLDB command line tool (sqltool) no longer works on Ubuntu 20.04 and later


On Ubuntu 18.04, I was able to shut down a running HSQLDB instance in server mode with the following one-liner:

java -cp $CLASSPATH:/usr/share/java/hsqldbutil.jar:/usr/share/java/hsqldb.jar "org.hsqldb.cmdline.SqlTool" --inlineRc=url=jdbc:hsqldb:hsql://localhost/$DB_NAME,user=SA,password= --sql="SHUTDOWN;"

After upgrading to Ubuntu 20.04 (with HSQLDB 2.4.1 and HSQLDB Utils 2.5.0), this fails with the following error:

Error: Could not find or load main class org.hsqldb.cmdline.SqlTool
Caused by: java.lang.ClassNotFoundException: org.hsqldb.cmdline.SqlTool

Indeed I can no longer find org.hsqldb.cmdline.SqlTool in either of the two JARs, nor any hint at where this functionality has disappeared.

The docs mention sqltool.jar, but I cannot find that file anywhere on my system.

Where has the SqlTool class gone? Or how else can I shut down a running HSQLDB instance from a shell script?


Solution

  • There is no officialy released jar named hsqldbutil.jar. There is an Ant and Gradle build option for that jar which consists of GUI clients.

    Download the hsqldb zip package from SourceForge via the download link at http://hsqldb.org

    The /lib directory of the zip package contains hsqldb.jar and sqltool.jar. Use these jars in your Java command. This also makes sure you are using the jars from the same release version, as mixing different releases will not function properly.