DBA > Job Interview Questions > DERBY Java Database FAQs

How to Shut Down Derby or an Individual Database

More DBA job interview questions and answers at http://dba.fyicenter.com/Interview-Questions/

(Continued from previous question...)

How to Shut Down Derby or an Individual Database?

Applications in an embedded environment shut down the Derby system by specifying the shutdown=true attribute in the connection URL. To shut down the system, you do not specify a database name, and you must not specify any other attribute.

jdbc:derby:;shutdown=true

A successful shutdown always results in an SQLException to indicate that Derby has shut down and that there is no other exception.

You can also shut down an individual database if you specify the databaseName. You can shut down the database of the current connection if you specify the default connection instead of a database name (within an SQL statement).

// shutting down a database from your application
DriverManager.getConnection(
"jdbc:derby:sample;shutdown=true");

(Continued on next question...)

Other Job Interview Questions