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.
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");