db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Lamote <phlam...@mac.com>
Subject Derby Config Question
Date Mon, 20 Mar 2006 11:39:26 GMT
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





Mime
View raw message