'HSQLDB command line shutdown no longer works after upgrade
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 1:[1]
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.
Solution 2:[2]
Just to expand a little on fredt's answer, here are the actual steps I used to address the issue on my 22.04 (jammy) workstation:
Ascertain which version your system is running with (Jammy seems to ship v2.6.1; substitute
2.6.1
with the appropriate version in the following):apt policy libhsqldb-java
Download the corresponding version from SourceForge: https://sourceforge.net/projects/hsqldb/files/hsqldb/
Extract
/hsqldb-2.6.1/hsqldb/lib/sqltool.jar
to/tmp
-
sudo -i mv /tmp/sqltool.jar /usr/share/java/sqltool-2.6.1.jar chown root: !$ vi $(type -p hsqldb-sqltool)
Add
/usr/share/java/sqltool-2.6.1.jar:
inCLASSPATH
afterhsqldb.jar:
and exitvi
(usenano
if you're not comfortable with vi)Don't forget to upvote user149408's bug on Launchpad: https://bugs.launchpad.net/ubuntu/+source/hsqldb/+bug/1909811 (login on top-right hand corner; click "This bug affects X person. Does this bug affect you?" link left above ticket).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | fredt |
Solution 2 |