databaseName=nameOfDatabase attribute

The databaseName=nameOfDatabase attribute specifies a database path name for a connection.

You can use this attribute instead of specifying the database name after the subprotocol.

The nameOfDatabase value can be either an absolute path name or a path name relative to derby.system.home. For example, thisDB, databases/thisDB, and c:/databases/2014/january/thisDB can all be valid values.

The path separator in the connection URL is a forward slash (/), even in Windows path names. The nameOfDatabase value cannot contain a colon (:), except for the colon after the drive name in a Windows path name.

For example, these URL (and Properties object) combinations are equivalent:
  • jdbc:derby:toursDB
  • jdbc:derby:;databaseName=toursDB
  • jdbc:derby: (with a property databaseName and its value set to toursDB in the Properties object passed into a connection request)

If you use a subsubprotocol to specify the database (for example, memory for an in-memory database), include the subsubprotocol as part of the databaseName attribute specification. For example:


If the database name is specified both in the URL (as a subname) and as an attribute, the database name set as the subname has priority. For example, the following database connection URL connects to toursDB:


Allowing the database name to be set as an attribute allows the getPropertyInfo method to return a list of choices for the database name based on the set of databases known to Derby. For more information, see java.sql.Driver.getPropertyInfo method.

Combining with other attributes

You can combine this attribute with all other attributes.