public List<CourseListing> getAll() {

        List<CourseListing> courseListing = new ArrayList<CourseListing>();

        try {
            //Connect to database

            conn = DriverManager.getConnection(url, userName, password);

            stmt = conn.createStatement();
            ResultSet rset = null, rset1 = null;

            PreparedStatement pstmt = null, pstmt1 = null;

            pstmt = conn.prepareStatement("select * FROM CourseProduct "
                    + "INNER JOIN Course "
                    + "ON CourseProduct.number=Course.number "
                    + "inner join Product "
                    + "on CourseProduct.P_ID=Product.P_ID "
                    + "group by Course.number");

            rset = pstmt.executeQuery();

            while (rset.next()) {

                String tempNumber = rset.getString("number");

                pstmt1 = conn.prepareStatement("select distinct product FROM "
                        + "CourseProduct INNER JOIN Course "
                        + "ON CourseProduct.number=Course.number "
                        + "inner join Product "
                        + "on CourseProduct.P_ID=Product.P_ID "
                        + "WHERE "
                        + "Course.number = ? order by product");

                pstmt1.setString(1, tempNumber);

                rset1 = pstmt1.executeQuery();

                String tempProduct = "";

                while (rset1.next()) {
                    tempProduct += " " + rset1.getString("product") + ",";
                }
                tempProduct = tempProduct.substring(0, tempProduct.length() - 1);

                courseListing.add(new CourseListing(
                        rset.getDouble("price"),
                        rset.getString("number"),
                        rset.getString("name"),
                        rset.getString("location"),
                        rset.getString("unit"),
                        rset.getString("duration"),
                        rset.getString("type"),
                        rset.getString("role"),
                        rset.getString("category"),
                        rset.getString("maxNumStudents"),
                        rset.getString("superProduct"),
                        rset.getString("subProduct"),
                        tempProduct));
            }

            this.response = "Searched";

        } catch (SQLException e) {
            response = "SQLException: " + e.getMessage();
            while ((e = e.getNextException()) != null) {
                response = e.getMessage();
            }
        } finally {
            try {
                if (stmt != null) {
                    stmt.close();
                }
                if (conn != null) {
                    conn.close();
                }
            } catch (SQLException e) {
                response = "SQLException: " + e.getMessage();
                while ((e = e.getNextException()) != null) {
                    response = e.getMessage();
                }
            }
        }
        return courseListing;

    }