public void run() throws InstantiationException, IllegalAccessException, SQLException {
        
        
        try {
            //Initalize connection to db
            Class.forName(con.getDriver()).newInstance();
            Connection conn = DriverManager.getConnection(con.getUrl() + con.getDbName(), con.getUserName(), con.getPassword());

            // make a query, request & display results   
            parseIngredients();

            Statement st = conn.createStatement();
            String sql = ("SELECT ID FROM recipes WHERE " + this.hakusyote + " time <= " + this.time);

            //gets IDS that fill           
            ResultSet rs1 = st.executeQuery(sql);
            List<Integer> ids = new ArrayList();
            while (rs1.next()) {

                ids.add(rs1.getInt("ID"));

            }
            // shuffle IDs
            Collections.shuffle(ids);

            //create new query which recovers parameters for randomized ID
            String sql2 = ("SELECT * FROM recipes WHERE ID = " + ids.get(0));

            //executes query2 to fetch information
            ResultSet rs2 = st.executeQuery(sql2);
            while (rs2.next()) {
                String name = rs2.getString("name");
                int time = rs2.getInt("time");
                String tarvikkeet = rs2.getString("ingredients");
                String valmistusohjeet = rs2.getString("instructions");

                
                tiedot.add(Integer.toString(time));
                tiedot.add(name);
                tiedot.add(calculateIngredAmounts(tarvikkeet));
                tiedot.add(valmistusohjeet);

//               System.out.println("Nimi: " + name);
//               System.out.println("Valmistusaika: " + time);
//               System.out.println("Ainekset: " + tarvikkeet);
//               System.out.println("Valmistusohjeet: " + valmistusohjeet);
            }

            conn.close();

        } catch (ClassNotFoundException x) {
            x.printStackTrace();
        } catch (InstantiationException a) {
            a.printStackTrace();
        } catch (IllegalAccessException b) {
            b.printStackTrace();
        }

    }