Here you can find the source of createConnection(String userName, String password)
private static Connection createConnection(String userName, String password)
//package com.java2s; //License from project: Open Source License import java.sql.Connection; import java.sql.DriverManager; import java.util.Properties; public class Main { private static Connection conn = null; private static String dbLocation = "droidReviewDB"; private static String dbURL = "jdbc:derby://localhost:1527/"; private static String driverName = "org.apache.derby.jdbc.ClientDriver"; private static Connection createConnection(String userName, String password) { try {//from ww w . j a va2 s .co m Class.forName(driverName); Properties dbProps = new Properties(); dbProps.put("user", userName); dbProps.put("password", password); conn = DriverManager.getConnection(dbURL + dbLocation, dbProps); } catch (Exception except) { System.out.print("Could not connect to the database with username: " + userName); System.out.println(" password " + password); System.out.println("Check that the Derby Network Server is running on localhost."); except.printStackTrace(); } return conn; } }