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 and
are listed in .
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");
Attributes are not parsed for correctness. If you pass in
an incorrect attribute or corresponding value, it is simply ignored. ( does provide a tool for
parsing the correctness of attributes. For more information, see the .)