# 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 Java DB 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 complete information about the attributes, see "Setting attributes for the database connection URL" in the Java DB Reference Manual.

For detailed information about the connection URL syntax, see Derby JDBC database connection URL.

- 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.
- Creating a database with territory-based collation
  By default, Derby uses Unicode codepoint collation. However, you can specify territory-based collation when you create the database.
- 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