powered by Jive Software

Access db on commandline lock



i need to access the embedded hsqldb from command line, like this:

root@openfire:/opt/bitnami/hsqldb-2.4.1/hsqldb/lib# java -jar sqltool.jar OPENFIRE cleanup-openfire.sql

and i get:

Failed to get a connection to ‘jdbc:hsqldb:/opt/bitnami/openfire/embedded-db/openfire’ as user “sa”.
Cause: Database lock acquisition failure: lockFile: org.hsqldb.persist.LockFile@ab0b1ff4[file =/opt/bitnami/openfire/embedded-db/openfire.lck, exists=true, locked=false, valid=false, ] method: checkHeartbeat read: 2018-09-05 07:49:01 heartbeat - read: -4079 ms.

i want to schedule a query via cron to delete some stuff:

“Delete from PUBLIC.ofMessageArchive where FROMJID like ‘user1%’ and TOJID like ‘user2%’;”

so how to access the db via command line same way like the db acceess plugin?



Haven’t ever tried to connect to it this way, but maybe you have to stop Openfire before doing that?


sure thats possible but not “cool” way… i only want to save time to manualy execute this query via db access plugin… and this plugin also dont need to “shutdown” openfire before ^^


DB Access works as a plugin and probably is accessing database directly in memory (embedded database is loaded into memory on startup and changes only flushed back to txt file in intervals).


hsqldb, if started as embedded (or stand-alone in-process) in Openfire, I believe will only allow connections from within the same JVM, not another tool such as “java -jar sqltool.jar”

If you start hsqldb separate (HSQLDB Server Instance), listening on some port, then configure Openfire to connect to it, you should also be able to access it from other tools not running in the same JVM.

The docs and hsqldb.org website seem to be down at the moment.

You might find this useful

See the section titled "In-Process (Standalone) Mode"

This mode runs the database engine as part of your application program in the same Java Virtual Machine. For most applications this mode can be faster, as the data is not converted and sent over the network. The main drawback is that it is not possible by default to connect to the database from outside your application. As a result you cannot check the contents of the database with external tools such as Database Manager while your application is running. In 1.8.0, you can run a server instance in a thread from the same virtual machine as your application and provide external access to your in-process database.

Also see the section "Server Modes"

Server modes provide the maximum accessibility. The database engine runs in a JVM and listens for connections from programs on the same computer or other computers on the network. Several different programs can connect to the server and retrieve or update information. Applications programs (clients) connect to the server using the HSQLDB JDBC driver. In most server modes, the server can serve up to 10 databases that are specified at the time of running the server.