To program user authentication into Derby applications, use the DriverManager.getConnection call to specify the user name and password.
An application can provide the user name and password in the following ways.
Connection conn = DriverManager.getConnection( "jdbc:derby:myDB", "mary", "little7xylamb");
Connection conn = DriverManager.getConnection( "jdbc:derby:myDB;user=mary;password=little7xylamb");
Properties p = new Properties(); p.put("user", "mary"); p.put("password", "little7xylamb"); Connection conn = DriverManager.getConnection( "jdbc:derby:myDB", p);
For information about the treatment of user names within the Derby system, see Users and authorization identifiers.