On 9/4/2012 6:12 AM, Kristian Waagan wrote:
On 04.09.2012 00:33, Rainier Diaz Ferrer wrote:
Hello Derby team, my name is Rainier, i'm having problems trying to connect to my derby database using network server. I set the derby home directory by using this. System.setproperty("derby.system.home", mylocalpathtoderbydb); this code line goes right before starting the server. When i try to connect it throws a database not found exception, if i copy the database to the current directory, where my application is executing from, it works fine, but i want it to find my database somewhere else,  which is in mylocalpathtoderbydb, set as derby.system.home. i would appreciate an answer. Thank you. Rainier

Hi Rainier,

Depending on how the driver is loaded, the property may be set too late.
You can try to set the property as a system property on the command line, or to specify it in derby.properties in your current working directory to verify that theory.

Are you starting Network Server with the NetworkServerControlControl API in the same JVM? If so,

I believe as a work around  you can deregister the autoloaded driver by shutting down Derby, e.g.
DriverManager.getConnection("jdbc:derby:;shutdown=true")  and then set your system property and restart Derby with Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance().

If you are launching a separate process, pass the system property on the command line as Kristian suggests.



Regards,
--
Kristian