I'm running in to some problems with generating a persistent HSQLDB and during some troubleshooting I came upon the following behavior.
Needs["DatabaseLink`"]
tc = OpenSQLConnection[
JDBC["hsqldb", ToFileName[Directory[], "temp"]], Username -> "sa"]
CloseSQLConnection[tc]
The above code generates three files (which will be located in Directory[]). Despite the fact that the connection is closed, two of the files (temp.lck and temp.log) cannot be deleted until the Mathematica kernel has been shut down. Is this 'normal' behavior?
"DatabaseLink`"connections in Mathematica are done via Java and it is the JRE which actually holds the file locks. To get rid of those locks you can e.g. useNeeds["JLink"];UninstallJava[];. After that you should be able to delete the files. There might be ways to remove those locks without closing the JRE with according Java calls, but that I don't know. I think it is an oversight (=bug) in the implementation of the HSQL part of"DatabaseLink`"that aCloseSQLConnectiondoesn't remove these file locks, so you might want to contact WRI and see what they say... – Albert Retey May 22 '13 at 10:50UninstallJava[]works well. It'll be interesting to see if WRI has any comment. Thanks. – bobthechemist May 22 '13 at 20:54