# deregister=false attribute

The deregister=false attribute, if set to true (the default), deregisters the embedded JDBC driver from the DriverManager after a shutdown, so that the Derby classes can be garbage-collected.

If you are running with a security manager on JDK 8 or higher, you must grant the following permission to derby.jar to allow the JDBC driver to be deregistered:

    permission java.sql.SQLPermission "deregisterDriver";

See "Configuring Java security" in the Derby Security Guide for details. If you do not grant this permission when using a security manager, an error message and stack trace will appear in derby.log on shutdown, and the embedded JDBC driver will remain registered.

If you are running with a security manager on JDK 6 or 7, you do not need to set this permission.

You initially register the embedded driver by calling a DriverManager method such as DriverManager.getDrivers() or DriverManager.getConnection().

Once the embedded driver is registered, you can shut down the Derby engine by using the shutdown=true connection URL attribute. If you also specify deregister=false with the shutdown URL, the following will happen:

- The embedded driver will remain registered.
- The Derby classes will not be garbage-collected.
- You can get a Derby connection by issuing a call to DriverManager.getConnection().

In contrast, if you use the default setting of deregister=true when you shut down the database, the following will happen:

- The embedded driver will be deregistered.
- The Derby classes will be garbage-collected.
- You will have to call Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance() before you obtain a new Derby connection by calling DriverManager.getConnection().

This attribute has no meaning if it is used with the network driver.

## Combining with other attributes

This attribute is valid only when issued in conjunction with the shutdown=true attribute.

## Examples

    -- shut down salesDB and deregister the driver
    jdbc:derby:salesDB;shutdown=true
    -- shut down salesDB, but do not deregister the driver
    jdbc:derby:salesDB;shutdown=true;deregister=false

Parent topic: Setting attributes for the database connection URL