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