tags:

views:

50

answers:

1

I don't want to use it in embedded mode as I may allow other external applications to access it as well. And I want to execute the startup of the server at the same time as Tomcat loads my application (or just when tomcat runs for that matter). This is so that I don't have to ask clients to manually run hsqldb with a command or script before they can put my war into tomcat and run it (to keep things simple).

I can perhaps call Server from main by sending command from Java, but this will give me a unending thread, I am not sure how to deal with that. Is there an easier tested way to do this?

A: 

You can use HSQLDB on any web/app server in embedded mode and allow external apps to access it by running the org.hsqldb.server.Servlet on your web/app server. The external apps will then connect to the servlet using the jdbc:hsqldb:http: type url's.

If you want to run org.hsqldb.server.Server (the version 2.0 class), or org.hsqldb.Server, as a separate process as Tomcat, you can use the class org.hsqldb.util.MainInvoker to call the main method for multiple classes (e.g. Tomcat and HSQLDB Server) with Server called first.

fredt