Hi Philippe,
I think this should work.
In your case the application is loading and setting all the Derby system
properties, whereas
following the Derby documentation way - pointing the derby.system.home
to the derby.properties, Derby would
have done it for you.
http://db.apache.org/derby/manuals/tuning/perf14.html#HDRSII-SETPROP-13074
-Rajesh
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:
Properties derbyProperties = new Properties();
try{
System.out.println("User dir property is "+
System.getProperty("user.dir"));
String pathname = System.getProperty("user.dir") +
"/src/.../conf/derby.properties";
derbyProperties.load(new FileInputStream(new File(pathname)));
}
catch (IOException ioe) {
System.out.println("Couldn't load Derby properties." + ioe);
}
Properties systemprops = System.getProperties();
systemprops.putAll(derbyProperties); // adds the Derby Properties to
this JVM's System Properties.
--> 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)
Thx,
Phil