Attributes of the Derby database connection URL

You can supply an optional list of attributes to a database connection URL.

Derby translates these attributes into properties, so you can also set attributes in a Properties object passed to DriverManager.getConnection. (You cannot set those attributes as system properties, only in an object passed to the DriverManager.getConnection method.)

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.

These attributes are specific to Derby and are listed in Setting attributes for the database connection URL.

Attribute name/value pairs are converted into properties and added to the properties provided in the connection call. If no properties are provided in the connection call, a properties set is created that contains only the properties obtained from the database connection URL.
import java.util.Properties;

Connection conn = DriverManager.getConnection(
    "jdbc:derby:sampleDB;create=true");

/* setting an attribute in a Properties object */
Properties myProps = new Properties();
myProps.put("create", "true");
Connection conn = DriverManager.getConnection(
    "jdbc:derby:sampleDB", myProps);

/* passing user name and password */
Connection conn = DriverManager.getConnection(
    "jdbc:derby:sampleDB", "dba", "password");
Note: Attributes are not parsed for correctness. If you pass in an incorrect attribute or corresponding value, it is simply ignored. (Derby does provide a tool for parsing the correctness of attributes. For more information, see the Derby Tools and Utilities Guide.)
Related concepts
Additional SQL syntax
Related reference
Derby database connection URL syntax
Syntax of database connection URLs for applications with embedded databases