# 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. If you specify any attributes both on the connection URL and in a Properties object, the attributes on the connection URL override the attributes in the Properties object.

All attributes are optional.

For more information on working with connection URL attributes, see the following:

- "Configuring database encryption" in the Derby Security Guide for information on database encryption
- Derby Server and Administration Guide for information on tracing network clients, replicating databases, restoring databases from backup, and logging on separate devices

For complete information about the attributes, see "Setting attributes for the database connection URL" in the Derby Reference Manual.

For detailed information about the connection URL syntax, see "Syntax of database connection URLs for applications with embedded databases" in the Derby Reference Manual.

- Using the databaseName attribute
  You can use a databaseName attribute on a database connection URL to specify the path 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 do not ordinarily 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 locale-based collation
  By default, Derby uses Unicode codepoint collation. However, you can specify locale-based collation when you create the database.
- Creating a case-insensitive database
  When you create a database using locale-based collation, the collation=collation value TERRITORY_BASED uses the default collation strength for the locale, usually TERTIARY, which will consider character case significant in searches and comparisons.
- Creating a customized collator
  You may need to define a collation order different from that of the strengths provided by the collation=collation attribute.
- 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