Description: Instead of specifying attributes on the connection URL, you can specify attributes as properties in a Properties object that you pass as a second argument to the DriverManager.getConnection method.
Keywords: Attributes (URL), setting as properties, Attributes to database connection URL, specifying with Properties object

# Specifying attributes in a properties object

Instead of specifying attributes on the connection URL, you can specify attributes as properties in a Properties object that you pass as a second argument to the `DriverManager.getConnection` method.

For example, to set the user name and password:

    Class.forName("org.apache.derby.jdbc.EmbeddedDriver");

    Properties p = new Properties();

    p.put("user", "sa");

    p.put("password", "manager");

    Connection conn = DriverManager.getConnection(

        "jdbc:derby:mynewDB", p);

Parent topic: Working with the database connection URL attributes
Related tasks
Creating and accessing a database
Related reference
Using the databaseName attribute