String driverClass, String driverPath, String propertiesLoadedFrom) throws SQLException, MalformedURLException {
String driverClass, String driverPath, String propertiesLoadedFrom) throws MalformedURLException {
    private static Connection getConnection(String user, String password, String connectionURL,                      String driverClass, String driverPath, String propertiesLoadedFrom) throws SQLException, MalformedURLException {        System.out.println("Using database properties:");        System.out.println("    " + propertiesLoadedFrom);        List classpath = new ArrayList();		List invalidClasspathEntries = new ArrayList();        StringTokenizer tokenizer = new StringTokenizer(driverPath, File.pathSeparator);        while (tokenizer.hasMoreTokens()) {            File pathElement = new File(tokenizer.nextToken());            if (pathElement.exists())                classpath.add(pathElement.toURL());            else				invalidClasspathEntries.add(pathElement);        }        URLClassLoader loader = new URLClassLoader((URL[])classpath.toArray(new URL[0]));        Driver driver = null;        try {            driver = (Driver)Class.forName(driverClass, true, loader).newInstance();            // have to use deprecated method or we won't see messages generated by older drivers            //java.sql.DriverManager.setLogStream(System.err);        } catch (Exception exc) {            System.err.println(exc); // people don't want to see a stack trace...            System.err.println();            System.err.println("Failed to load driver '" + driverClass + "' from: " + classpath);			if (!invalidClasspathEntries.isEmpty()) {				if (invalidClasspathEntries.size() == 1)					System.err.print("This entry doesn't point to a valid file/directory: ");				else					System.err.print("These entries don't point to valid files/directories: ");				System.err.println(invalidClasspathEntries);			}            System.err.println();            System.err.println("Use -t [databaseType] to specify what drivers to use or modify");            System.err.println("one of the .properties from the jar, put it on your file");            System.err.println("system and point to it with -t [databasePropertiesFile].");            System.err.println();            System.err.println("For many people it's easiest to use the -cp option to directly specify");            System.err.println("where the database drivers exist (usually in a .jar or .zip/.Z).");			System.err.println("Note that the -cp option must be specified after " + getLoadedFromJar());            System.err.println();            System.exit(1);        }        Properties connectionProperties = new Properties();        connectionProperties.put("user", user);        if (password != null)            connectionProperties.put("password", password);        Connection connection = null;        try {            connection = driver.connect(connectionURL, connectionProperties);            if (connection == null) {                System.err.println();                System.err.println("Cannot connect to this database URL:");                System.err.println("  " + connectionURL);                System.err.println("with this driver:");                System.err.println("  " + driverClass);                System.err.println();                System.err.println("Additional connection information may be available in ");                System.err.println("  " + propertiesLoadedFrom);                System.exit(1);            }        } catch (UnsatisfiedLinkError badPath) {            System.err.println();            System.err.println("Failed to load driver [" + driverClass + "] from classpath " + classpath);            System.err.println();            System.err.println("Make sure the reported library (.dll/.lib/.so) from the following line can be");            System.err.println("found by your PATH (or LIB*PATH) environment variable");            System.err.println();            badPath.printStackTrace();            System.exit(1);        } catch (Exception exc) {            System.err.println();            System.err.println("Failed to connect to database URL [" + connectionURL + "]");            System.err.println();            exc.printStackTrace();            System.exit(1);        }        return connection;    }