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.system.home not being honoured!
Date Thu, 21 Sep 2006 09:34:44 GMT
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 issue?


-- 
John


Mime
View raw message