2

I'm running this as an in-process connection, using this JDBC URL:

jdbc:hsqldb:file:C:\Program Files\360Works\SyncData2_MirrorSync\Configurations\3d0c6a29-294b-4a24-b075-70302345fdb5\mirrorsync

I am getting this error, even after completely rebooting the computer:

java.util.concurrent.ExecutionException: java.sql.SQLException: Database lock acquisition failure: lockFile: org.hsqldb.persist.LockFile@e27ecaee[file =C:\Program Files\360Works\SyncData2_MirrorSync\Configurations\3d0c6a29-294b-4a24-b075-70302345fdb5\mirrorsync.lck, exists=true, locked=false, valid=false, ] method: checkMagic magic: '0000000000000000'

How can I fix this?

Jesse Barnum
  • 6,507
  • 6
  • 40
  • 69
  • possible duplicate of [Database lock acquisition failure and hsqldb](http://stackoverflow.com/questions/3968595/database-lock-acquisition-failure-and-hsqldb) – Scary Wombat Oct 21 '14 at 00:47
  • Programs running without elevated privileges (e.g., not "Run as administrator") have restricted access to the %ProgramFiles% folders. Try moving the database (at least temporarily) to a location where normal users can read/write, say, "Public Documents". Or, if you only need read access to the database then try appending `;readonly=true` to the connection URL. – Gord Thompson Oct 21 '14 at 10:44
  • @Scary Wombat: I'm pretty sure this is a different type of problem than the referenced one, because I'm not attempting to connect to the HSQL database from an external process. – Jesse Barnum Oct 23 '14 at 17:06

3 Answers3

4

I solved the problem by manually deleting the .lck file referenced by the error message.

Jesse Barnum
  • 6,507
  • 6
  • 40
  • 69
1

Add the flowing property hsqldb.lock_file=false;

For example hsqldb.lock_file=false;hsqldb.sqllog=3;shutdown=true;syntax_ora=true

1

You can access HSQLDB database that has lock by:

1- updating my-db-name.properties file and add:

hsqldb.lock_file=false

2- or removing my-db-name.lck file.

3- or connect to the database using pass the properties as parameters:

#Without Sqltool:
    java -cp [jar-path]/hsqldb-2.4.0.jar --inlineRc=url=jdbc:hsqldb:file:/[my-db-file-path]/[db-name];readonly=true;hsqldb.lock_file=false,user=sa

#With Sqltool
    java -cp [jar-path]/hsqldb-2.4.0.jar:[jar-path]/sqltool-2.4.0.jar org.hsqldb.cmdline.SqlTool --inlineRc=url=jdbc:hsqldb:file:/[my-db-file-path]/[db-name];readonly=true;hsqldb.lock_file=false,user=sa

Other HSQLDB database parameters can be found here, however note that only few of them can be updated after first time. http://hsqldb.org/doc/2.0/guide/dbproperties-chapt.html

Safa Far
  • 86
  • 3