Using a HSQLDB file on Tomcat

In my Grails application, I was using an HSQL Database.  However, I wanted changes to persist when restarting my server so I configured it to use the file system.

dataSource {
    dbCreate = "update"
    url = "jdbc:hsqldb:file:DB/appDB;shutdown=true"
}

When running in a development environment, a DB directory was created in my Project home directory. The DB directory contained the appDB.script and appDB.log files that are used by HSQLDB.

However, I wanted to use the same connection string while deploying my application as a WAR on Apache Tomcat.  I dropped my WAR in the <TOMCAT_HOME>\webapps folder and started Tomcat.  However, I struggled to find where the data files were kept.

For future reference, they are in the DB directory in <TOMCAT_HOME>\bin.

Advertisements

About stevewall123

I am a Lead Software Engineer in Minneapolis working for Thomson Reuters. I am currently working on projects using Java, JavaScript, Spring, Drools, Hazelcast, Liquibase and Tomcat. Previously, I used C#, GWT, Grails, Groovy, JMS and JBoss Drools Guvnor. In the past I have worked on projects using J2EE, Swing, Webwork, Hibernate, Spring, Spring-WS, JMS, JUnit and Ant.
This entry was posted in Grails and tagged , . Bookmark the permalink.

2 Responses to Using a HSQLDB file on Tomcat

  1. Olivier says:

    You can use an absolute path :

    dataSource.url=jdbc:hsqldb:file:C:/4CAD/db_files/database.properties;shutdown=true

    • stevewall123 says:

      Yes, and I should have mentioned that as well. In my case, I was going to end up handing my WAR file off to someone else, so I didn’t want to use an absolute path.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s