# Working with the database connection URL attributes

You specify attributes on the Derby connection URL.

The examples in this section use the syntax of the connection URL for use in an embedded environment. You can also specify these same attributes and values on the client connection URL if you are using Derby as a database server. For more information, see the Derby Server and Administration Guide.

You can also set these attributes by passing a Properties object along with a connection URL to `DriverManager.getConnection` when obtaining a connection; see "Specifying Attributes in a Properties Object".

All attributes are optional. For detailed information about the connection URL syntax and attributes, see "Derby Database Connection URL Syntax"in the Derby Reference Manual.

You can specify the following attributes:

- bootPassword=key
- create=true
- databaseName=nameofDatabase
- dataEncryption=true
- encryptionProvider=providerName
- encryptionAlgorithm=algorithm
- territory=ll_CC
- logDevice=logDirectoryPath
- createFrom=BackupPath
- restoreFrom=BackupPath
- rollForwardrecoveryFrom=BackupPath
- password=userPassword
- shutdown=true
- user=userName

- Using the databaseName attribute
  You can use a databaseName attribute on a database connection URL to specify the name of the database to which you want to connect.
- Shutting 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.
- Creating and accessing a database
  You create a database by supplying a new database name in the connection URL and specifying create=true.
- Providing a user name and password
  When user authentication is enabled, an application must provide a user name and password. One way to do this is to use the user=userName and password=userPassword connection URL attributes.
- Encrypting a database when you create it
  If your environment is configured properly, you can create your database as an encrypted database (one in which the database is encrypted on disk). To do this, you use the dataEncryption=true attribute to turn on encryption and the bootPassword=key attribute or the encryptionKey attribute to specify a key for the encryption.
- Creating an encrypted database with an external key
  You can create a database and encrypt the database with an external key.
- Booting an encrypted database
  You must specify several attributes in the URL when you boot an encrypted database. You must specify these attributes the first time that you connect to the database within a JVM session, or after you shut the database down within the same JVM session.
- Specifying attributes in a properties object
  Instead of specifying attributes on the connection URL, you can specify attributes as properties in a Properties object that you pass as a second argument to the DriverManager.getConnection method.

Parent topic: Derby embedded basics
Related concepts
Derby JDBC driver
Derby JDBC database connection URL
Derby system
A Derby database
Connecting to databases