db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Harrigan" <david.harri...@orange-ft.com>
Subject RE: derby.system.home not being honoured!
Date Thu, 21 Sep 2006 09:47:16 GMT
Hi John,

Fantastic! That was the issue. I moved the call to
getDerbySystemHome() to my static initaliser block (yes,
you are correct in assuming it's an embedded instance) and
now it finds the database. Thank you indeed for your
prompt reply.


-----Original Message-----
From: John.Embretsen@Sun.COM [mailto:John.Embretsen@Sun.COM] 
Sent: 21 September 2006 10:35
To: Derby Discussion
Subject: Re: derby.system.home not being honoured!

David Harrigan wrote:

> I'm invoking my class under test and in that class I have:
> System.setProperty("derby.system.home", getDerbySystemHome()); 
> connection = DriverManager.getConnection("jdbc:derby:searchdb",
> System.getProperties());
> The getDerbySystemHome() returns a directory that is inside the 
> project directory within eclipse, (projectname/web/WEB-INF/classes/)
> yet I continuously get this error when I try to execute the test:
> EmbedSQLException : Database 'searchdb' not found.
> If I change the connection string to:
> jdbc:derby:searchdb;create=true
> It creates the database, but at the ROOT of the eclipse project! i.e.,
> (projectname/searchdb)
> My question is this, why is Derby not honouring the derby.system.home 
> that I am explicitly setting in the System properties and then 
> subsequently passing into the DriverManager...

derby.system.home is a static property that must be set before Derby
starts, i.e. before the driver is loaded (I assume you are using the
embedded driver). When you call getConnection(...), Derby has already
started, so the new property value will have no effect. Does setting the
property before loading the driver (Class.forName(...)) resolve your


This email and the files transmitted with it are meant solely for the use of the individual
addressee(s) named above. They may contain confidential and/or legally privileged information.
If you are not the addressee(s) or responsible for delivery of the message to the addressee(s),
please delete it from your system and contact the sender right away. The opinions, conclusions
and other information in this message which do not relate to the official business of Orange
Home UK plc are not necessarily endorsed by it. Orange Home UK plc has taken steps to ensure
that this email and any attachments are virus-free, but it remains your responsibility to
confirm and ensure this.

Orange Home UK plc is a subsidiary of France Telecom SA. Our registered office is at: Verulam
Point, Station Way, St. Albans, Herts, AL1 5HE, and we are registered in England and Wales,
as Company No. 3014367

View raw message