db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: connection strange behavior
Date Wed, 19 Jul 2006 16:31:18 GMT
Flavio Palumbo wrote:
> Hi all,
> I wrote a little class, derived from NsSample.java found in D:\db-derby-\demo\nserverdemo,
> to start an embedded server and use it with an embedded client (no embedded
> driver but org.apache.derby.jdbc.ClientDriver) fron within a java application,
> all in the same JVM.
> The first strange thing I found is that if I try to access the data with
> the ij utility while the application is running, I receive a messagge like
> this :
> ERROR XJ040: Failed to start database 'c:\ESQueryProd\derbyDB', see the next
> exception for details.
> ERROR XSDB6: Another instance of Derby may have already booted the database
> C:\ESQueryProd\derbyDB.
> Obviously, when I close the application everything goes fine.
> I thought that network server shares connection and data, but it seems not
> to be true.
> How can I do that ?

Hello Flavio,

If I understand you correctly, what you are trying to do should be 
possible. To make sure we are on the same page here, I have written a 
small application that creates two connections to a database:
  1) I instruct Derby to start the NetworkServer by setting the property 
derby.drda.startNetworkServer = true.
  2) The first connection creates the database 'testDB' using the 
embedded driver. The network server is also started now.
  3) The second connection to 'testDB' is created by using the client 
  4) I can connect to the same database using ij by specifying the
     following command (from ij):
     > connect 'jdbc:derby://localhost/testDB';

Does this demonstrate what you are trying to to?
You need to have the Derby jars in your classpath when running the 
application (and ij). Which exactly depends on your Derby version.

I think there are variations on how to do this, and I'm sure people will 
let us know if there are easier/better ways to do it.

If you have further questions, we'll try to answer them :)


> I found the same behavior starting the application twice from newtwork :
> the first application starts correctly, the second freezes until I shut down
> the first.
> Thanks for any suggetion
> Flavio
> PS I run with jvm 1.4.2_09 with win XP sp2 and derby

View raw message