Reputation: 1424
I am using SpringRoo to build a webApp and hsqlDB ( InMemory ) As a database. I need to locate the database file that is used. So I can Use a hsqlDb GUI to see the content of my database, Where the hsqldb files are located ?
Upvotes: 0
Views: 391
Reputation: 149175
Well I am afraid you cannot do that. Embedded databases are only accessible from within one JVM (at least the ones I know : hsqlDb, Derby, H2). And the content of a memory only database is lost when you close it.
To be able to look at the database content with a GUI, you must use a file backed database, and you will be able to use it only when the webApp is stopped.
For hsqlDb, you can use an Url of (just examples) :
jdbc:hsqldb:file:C:/databases/hsqldb/mywebapp (for Windows)
jdbc:hsqldb:file:/var/db/hsqldb/mywebapp (for Linux or other Unixes)
In those cases, the location of the database is pretty evident :-)
If you want to access to the database while the webApp is running, you have to use server mode and start a server before starting the webApp. Example form HSQLB documentation The following example of the command for starting the server starts the server with one (default) database with files named "mydb.*" and the public name of "xdb". The public name hides the file names from users
java -cp ../lib/hsqldb.jar org.hsqldb.server.Server --database.0 file:mydb --dbname.0 xdb
You access such a database with following Url : jdbc:hsqldb:hsql://localhost/xdb
Upvotes: 3