@SuppressWarnings("unchecked")
    public String loadEvents() {
        PreparedStatement st = null;
        ResultSet rs = null;
        JSONArray json = new JSONArray();
        try {
            conn = dbconn.getConnection();
            st = conn.prepareStatement("SELECT * FROM events");
            rs = st.executeQuery();
            while (rs.next()) {
                JSONObject o = new JSONObject();
                o.put("id", rs.getInt("id"));
                o.put("name", rs.getString("name"));
                o.put("location", rs.getString("location"));
                if (rs.getDate("start_date") != null) {
                    o.put("start_date", rs.getDate("start_date").toString());
                } else {
                    o.put("start_date", "");
                }
                if (rs.getDate("end_date") != null){
                    o.put("end_date", rs.getDate("end_date").toString());
                } else {
                    o.put("end_date", "");
                }
                json.add(o);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try{
                conn.close();
                st.close();
                rs.close();
            }catch (SQLException e) {
                System.out.println("Error closing query");
            }
        }
       return json.toString();
    }