# shutdown=true attribute

The shutdown=true attribute shuts down the specified database if you specify a databaseName. (Reconnecting to the database reboots the database.)

For a database for which authentication and SQL authorization are both enabled, only the database owner can perform shutdown of that database. See "Configuring user authentication" and "Configuring user authorization" in the Derby Security Guide for more information.

Shuts down the entire Derby system if and only if you do not specify a databaseName.

When you are shutting down a single database, the attribute lets Derby perform a final checkpoint on the database.

When you are shutting down a system, the attribute lets Derby perform a final checkpoint on all system databases, deregister the JDBC driver (if permitted; see deregister=false), and shut down within the JVM before the JVM exits. A successful shutdown always results in an SQLException indicating that Derby has shut down and that there is no connection. Once Derby is shut down, you can restart it by reloading the driver. For details on restarting Derby, see "Shutting down the system" in the Derby Developer's Guide.

Checkpointing means writing all data and transaction information to disk so that no recovery needs to be performed at the next connection.

The attribute is used to shut down the entire system only when it is embedded in an application.
Note: Any request to the DriverManager with a shutdown=true attribute raises an exception.

## Combining with other attributes

This attribute may be combined with the deregister=false attribute.

When you shut down a database, if authentication is turned on, you must specify this attribute in conjunction with the user=userName and password=userPassword attributes. If both authentication and SQL authorization are turned on, the user must be the database owner.

When you shut down the Derby system, if both authentication and SQL authorization are turned on, you must specify this attribute in conjunction with the user=userName and password=userPassword attributes.

## Examples

    -- shut down entire system
    jdbc:derby:;shutdown=true
    -- shut down salesDB (authentication not enabled)
    jdbc:derby:salesDB;shutdown=true
    -- shut down an in-memory database using the embedded driver
    jdbc:derby:memory:myInMemDB;shutdown=true
    -- shut down an in-memory database using the Network Server
    jdbc:derby://localhost:1527/memory:myInMemDB;shutdown=true

Parent topic: Setting attributes for the database connection URL