databaseName=nameofDatabase attribute databaseName=nameOfDatabase database connection URL attribute
Function

Specifies a database name for a connection; it can be used instead of specifying the database name in after the subprotocol.

Connecting to a database (using databaseName attribute)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 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:

jdbc:derby:toursDB;databaseName=flightsDB

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 . For more information, see .

Combining with other attributes

You can combine this attribute with all other attributes.

jdbc:derby:;databaseName=newDB;create=true