public void connect() throws NamingException, SQLException {
        // Is this a reconnection?  If so, disconnect first.
        if (con != null) disconnect();
        try {
        	String url = "jdbc:postgresql://localhost/stocksim";
        	Properties props = new Properties();
            props.setProperty("user", "ubuntu");
            props.setProperty("password", "reverse");
            con = DriverManager.getConnection(url, props);

            // Prepare statements:
            for (PreparedStatementID i: PreparedStatementID.values()) {
                PreparedStatement preparedStatement = con.prepareStatement(i.sql);
                _preparedStatements.put(i, preparedStatement);
            }
        } catch (SQLException e) {
            if (con != null) disconnect();
            throw e;
        }
    }