db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Embretsen <John.Embret...@Sun.COM>
Subject Re: Derby Config Question
Date Tue, 21 Mar 2006 09:38:09 GMT
Philippe Lamote wrote:

> Hi List, 
> I'm new to Derby so if this is too trivial, don't mind rubbing my nose 
> into it ;-)
> I have in my setup one place where I keep all the configuration 
> together. (jdoconfig.properties, Spring Configuration, ... )
> Of course this would be the obvious place to also put the 
> "derby.properties". Yet this is not the place where I put the Derby data 
> files themselves. 
> So, in short, this would be the "package" layout:
> - src/.../conf/derby.properties  (will be copied to bin/.../conf @ 
> compile time)
> - data/... (the Derby data dir)
> But then I read in the derby Manual: "You can set persistent system-wide 
> properties in a text file called /derby.properties/, which 
> must be placed in the directory specified by the /derby.system.home/ 
> property."
> I understand that "derby.system.home" would be this data directory and 
> this is not where I want to put the Derby properties.
> I thought of this to solve it: in the general Application init method, 
> adding this:

<snip example of setting system properties programmatically>

> --> Is this OK for Derby? And will the properties specified there indeed 
> be set & active upon the next connect?  (and not make it put all the dat 
> files in my conf folder)

Yes, I think this will work, as long as you connect to the database (or start 
an embedded Derby server) from the same instance of the JVM.

I would, however, like to point out that properties specified 
programmatically (which is your solution) have higher precedence than 
properties that are automatically picked up by Derby from the 
derby.properties file; see the Derby Tuning Guide, 
http://db.apache.org/derby/docs/dev/tuning/. This may be a corner case, but:

Quoting http://db.apache.org/derby/docs/dev/tuning/ctunsetprop23308.html:


This means, for example, that system-wide properties set programmatically 
override database-wide properties and system-wide properties set in the 
derby.properties file, and that database-wide properties override system-wide 
properties set in the derby.properties file.


So, if (for example) you previously relied on database-wide properties 
overriding system-wide properties in the derby-properties file as it was 
automatically picked up by Derby, you will find that this no longer happens, 
since the properties are set programmatically instead, thus overriding the 
database-wide properties.

Another possible work-around is to specify "full" database paths (absolute or 
relative to derby.system.home), see 


View raw message