If the application that started the embedded quits
but leaves the JVM running, continues
to run and is available for database connections.
In an embedded system,
the application shuts down the system
by issuing the following JDBC call:
DriverManager.getConnection("jdbc:derby:;shutdown=true");Shutdown
commands always raise SQLExceptions.
When a system
shuts down, a message goes to the error log:
Sat Jan 10 14:31:54 PDT 2005:
Shutting down instance 80000001-00d0-8bdf-d115-000a0a0b2d00Typically,
an application using an embedded engine
shuts down just before
shutting itself down. However, an application can shut down and
later restart it in the same JVM session. To restart successfully,
the JVM needs to unload org.apache.derby.jdbc.EmbeddedDriver, so that
it can reload it when it restarts .
(Loading the local driver starts .)
You
cannot explicitly request that the JVM unload a class, but you can ensure
that the EmbeddedDriver class is unloaded by using a System.gc() to
force it to garbage collect classes that are no longer needed. Running with -nogc or -noclassgc definitely prevents the class from being unloaded and makes you unable to restart in the same JVM.
It
is also possible to shut down a single database instead of the entire system. See .
You can reboot a database in the same session
after shutting it down.