Correct behavior of lock file in hsqldb connection

"DatabaseLink"` connections in Mathematica are done via Java and it is the Java virtual machine which actually holds the file locks. To get rid of those locks you can e.g. use:

Needs["JLink"];
UninstallJava[]; 

After that you should be able to delete the files (you can do that from Mathematica, if so desired with DeleteFile). There might be ways to remove those locks without closing the JVM with according Java calls to the underlying HSQL libraries, but that I don't know (and have not time to explore).

I think it is an oversight (=bug) in the implementation of the HSQL part of "DatabaseLink`" that a CloseSQLConnection doesn't remove these file locks, so you might want to contact WRI and see what they say...


The last paragraph here indicates that the .lck extension is assumed by the OS to be managed by the application (which in this case is Mathematica). The .log is also in that category. The solution is to specifically delete those files after

CloseSQLConnection[tc]

I use the CUD pattern when programming: Create, Use, and Dispose. Mainly for memory allocations and temporary files.

Tags:

Databaselink