Derby shutdown in embedded server

I want to start a derby embeded server in my application (see http://db.apache.org/derby/manuals/admin/hubprnt09.html#HDREMBEDDEDSERVEREX), in such a way that the application could access to the database in embedded way to get the maximum performance and, simultaneously, I can connect to the DB from other tools to explore the database (eg. DBVisualizer).

There are to ways to start the embedded server:

1) setting the derby.drda.startNetworkServer property to true

2) starting (and shutting down) the network server through the NetworkServerControl

the problem with both approaches is when the application finalizes, it appears that the databsae shutdown is not properly executed because the "db.lck" archive and the "tmp" directory remains there.

Any idea?

[796 byte] By [supertorpea] at [2007-11-27 10:22:23]
# 1

To get a clean shutdown:

NetworkServerControl server = new NetworkServerControl(InetAddress.getByName("localhost"), 1527);

server.start(null);

...

...

server.shutdown();

try

{

DriverManager.getConnection("jdbc:derby:;shutdown=true");

}

catch(Exception ex)

{

// do nothing; see http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html#shutdown

}

supertorpea at 2007-7-28 17:15:44 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...