PDA

View Full Version : hsqldb: using file based db in WEB-INF dir



briankuhn
Aug 19th, 2004, 03:36 PM
Hi all,

I'm trying to setup a demo application that requires no installation other than deploying a war file. I'm trying to use a hsql database that resides in something like /WEB-INF/data/hsql.script. Since hsql allows you to specify this path in it's URL, I'm able to do this using the full path. However, I'd like to be able to do the same thing with the context relative path (/WEB-INF/data/hsql) or somehow inject (at runtime) the full path into my applicationContext.xml file, something like the following snippet. Any ideas?

Thanks,
Brian

<bean id="dataSource"
class="org.sprin...DriverManagerDataSource">

<property name="driverClassName">
<value>org.hsqldb.jdbcDriver</value>
</property>

<property name="url">
<value>jdbc:hsqldb:${webapp-root}/WEB-INF/data/hsql</value>
</property>

<property name="username">
<value>sa</value>
</property>

<property name="password">
<value></value>
</property>

</bean>

briankuhn
Aug 24th, 2004, 03:44 PM
Is my question unclear?

Colin Sampaleanu
Aug 24th, 2004, 04:15 PM
Keep in mind this is actually not very portable. Some environments, like WebLogic BEA, do not even extract all the contents of WAR files, but rather access them via a ZipFileClassloader...

briankuhn
Aug 24th, 2004, 04:28 PM
Thanks. I hadn't considered that. I'll look for another way to do this...

trisberg
Aug 24th, 2004, 04:59 PM
I'm pretty sure you would limit yourself to a single user at a time running in standalone mode as well. If there is an active connection, then additional connections to the same database fail.