Multiple Java Applications accessing one HSQLDB causes app to hang
This is semi-related to my previous [question][1].  As that previous question states, I have a desktop app that calls off to a different Main method that will kick off a particular process.  Both the desktop app and the separate Main method will access the same HSQLDB database.

Prior to getting this far, my desktop app had just been accessing the HSQLDB database using a connection URL like this one:

    jdbc:hsqldb:file:/some/path/myDatabase

Now this works fine in a single user environment.  Now that I've got a multi-user environment with the desktop app and the separate Main process wanting to read/write to/from this database, I wanted to make this database a shared resource.  

I've had a look at the [HSQLDB documentation][2] and this post about [Creating a shared HSQLDB database][3] but to no avail.

In the post it talks about starting up the server via code.  I don't think this is what I want to do as I would like to have the HSQLDB database up and running all the time as there could be multiple users of the desktop app.

Looking at the official HSQLDB documentation, it states that you can start an HSQLDB server like this:

    java -cp ../lib/hsqldb.jar org.hsqldb.Server -database.0 file:mydb -dbname.0 xdb

If I run the above command with my own database file and name, it seems to start up okay:

    [Server@6ca1c]: [Thread[main,5,main]]: checkRunning(false) entered
    [Server@6ca1c]: [Thread[main,5,main]]: checkRunning(false) exited
    [Server@6ca1c]: Startup sequence initiated from main() method
    [Server@6ca1c]: Loaded properties from [/some/path/myDatabase/server.properties]
    [Server@6ca1c]: Initiating startup sequence...
    [Server@6ca1c]: Server socket opened successfully in 16 ms.

I then changed my connection URL to the following:

    jdbc:hsqldb:hsql://localhost/xdb

This does not seem to work for me.  Any ideas as to what I've done wrong or what I could be missing?

Furthermore, when the desktop app calls off to the external Main method the desktop app just hangs as the external Main method notices that the desktop app seems to have a lock on the database.  As soon as I shut down the desktop app, the external Main method actually does what I expected it to do.

  [1]: http://stackoverflow.com/questions/4310605/execute-java-main-method-from-within-a-java-desktop-app-in-a-different-jvm
  [2]: http://hsqldb.org/doc/guide/ch01.html#N10148
  [3]: http://stackoverflow.com/questions/964540/creating-a-shared-hsqldb-database
Multiple Java Applications accessing one HSQLDB causes app to hang
===

This is semi-related to my previous [question][1].  As that previous question states, I have a desktop app that calls off to a different Main method that will kick off a particular process.  Both the desktop app and the separate Main method will access the same HSQLDB database.

Prior to getting this far, my desktop app had just been accessing the HSQLDB database using a connection URL like this one:

    jdbc:hsqldb:file:/some/path/myDatabase

Now this works fine in a single user environment.  Now that I've got a multi-user environment with the desktop app and the separate Main process wanting to read/write to/from this database, I wanted to make this database a shared resource.  

I've had a look at the [HSQLDB documentation][2] and this post about [Creating a shared HSQLDB database][3] but to no avail.

In the post it talks about starting up the server via code.  I don't think this is what I want to do as I would like to have the HSQLDB database up and running all the time as there could be multiple users of the desktop app.

Looking at the official HSQLDB documentation, it states that you can start an HSQLDB server like this:

    java -cp ../lib/hsqldb.jar org.hsqldb.Server -database.0 file:mydb -dbname.0 xdb

If I run the above command with my own database file and name, it seems to start up okay:

    [Server@6ca1c]: [Thread[main,5,main]]: checkRunning(false) entered
    [Server@6ca1c]: [Thread[main,5,main]]: checkRunning(false) exited
    [Server@6ca1c]: Startup sequence initiated from main() method
    [Server@6ca1c]: Loaded properties from [/some/path/myDatabase/server.properties]
    [Server@6ca1c]: Initiating startup sequence...
    [Server@6ca1c]: Server socket opened successfully in 16 ms.

I then changed my connection URL to the following:

    jdbc:hsqldb:hsql://localhost/xdb

This does not seem to work for me.  Any ideas as to what I've done wrong or what I could be missing?

Furthermore, when the desktop app calls off to the external Main method the desktop app just hangs as the external Main method notices that the desktop app seems to have a lock on the database.  As soon as I shut down the desktop app, the external Main method actually does what I expected it to do.

  [1]: http://stackoverflow.com/questions/4310605/execute-java-main-method-from-within-a-java-desktop-app-in-a-different-jvm
  [2]: http://hsqldb.org/doc/guide/ch01.html#N10148
  [3]: http://stackoverflow.com/questions/964540/creating-a-shared-hsqldb-database