Get jar files:
mvn dependency:get -Dartifact=org.hsqldb:hsqldb:2.4.0
mvn dependency:get -Dartifact=org.hsqldb:sqltool:2.4.0
Both of those jars can be executed directly. The first one contains a GUI, the second one a command line interface. Both should be usable also with other JDBC databases. The sqltool needs the hsqldb driver jar to exist in the current working directory.
java -jar ~/.m2/repository/org/hsqldb/hsqldb/2.4.0/hsqldb-2.4.0.jar \
--url jdbc:hsqldb:file:target/TestDBs/db3
SCRIPT 'dump.sql'
This SQL command will throw an error if the file alrady exists.
cp ~/.m2/repository/org/hsqldb/hsqldb/2.4.0/hsqldb-2.4.0.jar .
java -jar ~/.m2/repository/org/hsqldb/sqltool/2.4.0/sqltool-2.4.0.jar \
--inlineRc url=jdbc:hsqldb:file:target/TestDBs/db4,user=SA,password= \
dump.sql
HSQL connection url to use MVCC/serializable isolation:
jdbc:hsqldb:file:dbdir/db;hsqldb.tx=mvcc;hsqldb.tx_level=SERIALIZABLE