You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Afkham Azeez <af...@gmail.com> on 2006/02/01 07:06:19 UTC

Keeping derby.properties and the database files in different directories

Hi Folks,

I have my derby.properties file in $MY_PROJECT/conf directory. This is
the directory pointed to by the derby.system.home System property. But
no my database is getting created under $MY_PROJECT/conf e.g. as
$MY_PROJECT/conf/DATABASE.

I need my database to be created as $MY_PROJECT/DATABASE. Is there a
property I can specify in the derby.properties file which will specify
the physical location of the Database?
--
Thanks in Advance
Afkham Azeez

Re: Keeping derby.properties and the database files in different directories

Posted by Stanley Bradbury <St...@gmail.com>.
Afkham Azeez wrote:

>Hi Folks,
>
>I have my derby.properties file in $MY_PROJECT/conf directory. This is
>the directory pointed to by the derby.system.home System property. But
>no my database is getting created under $MY_PROJECT/conf e.g. as
>$MY_PROJECT/conf/DATABASE.
>
>I need my database to be created as $MY_PROJECT/DATABASE. Is there a
>property I can specify in the derby.properties file which will specify
>the physical location of the Database?
>--
>Thanks in Advance
>Afkham Azeez
>
>  
>

You have a couple of options. 
1) If the URL is being specified in a program you can expand $MY_PROJECT 
and use it to construct a fullpath database URL  (e.g. 
DriverManager.getConnection("jdbc:derby:/var/myProjDir/theDB")

2) Otherwise you need to set the properties someway other than using a 
derby.properties file.
Set derby.system.home to the location where you want your databases 
created and set the properties as JVM arguments (e.g. java 
-D<property>=<value>) in a way similar to how you are setting 
derby.system.home.
the properties.  If you are using a Server there is often a .properties 
file that the server loads when it starts.

HTH