You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Kevin Wu <bo...@gmail.com> on 2007/03/16 08:32:15 UTC

question about derby database location

I have a java web application on a virtual host with Tomcat. 

I do not want to set my embedded derby database's home by absolutely path. I
hope it can location in the web application's root directory. 

But when I set the URL like this jdbc:derby:DBTest;create=true. The DBTest
database always been created in tomcat's bin directory. 

Because I'm not sure the relationship with the host's tomcat directory and
my application location, 

I don't know what could I do, it can easily locate in my own web
application.

 


Re: question about derby database location

Posted by Imran Hussain <im...@imranweb.com>.
Kevin,

Before starting the database, set the value for "derby.system.home". For 
example:

System.setProperty("derby.system.home", "/home/derby/"); // Use absolute 
path here.

When you run tomcat, the value for "user.dir" is set to Tomcat home. 
This why if you do not specify absolute path the relative path will 
always start with tomcat home.

Regards,
Imran.

Kevin Wu wrote:
>
> I have a java web application on a virtual host with Tomcat.
>
> I do not want to set my embedded derby database?s home by absolutely 
> path. I hope it can location in the web application?s root directory.
>
> But when I set the URL like this jdbc:derby:DBTest;create=true. The 
> DBTest database always been created in tomcat?s bin directory.
>
> Because I?m not sure the relationship with the host?s tomcat directory 
> and my application location,
>
> I don?t know what could I do, it can easily locate in my own web 
> application.
>