What is the best way to get my mysql data into a JList. I can connect to the database and output the results. I've been looking at various ways online but not getting the desired results. Instead of posting any code, are there any great tutorials showing how this is done, or any code snips.
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection
("jdbc:mysql://www", "....", "....");
st = con.createStatement();
} catch (Exception ex) {
System.out.println("error" + ex);
}
try {
String query = "select * from demo";
rs = st.executeQuery(query);
System.out.println("Records from Database");
while(rs.next()) {
String number = rs.getString("number");
System.out.println(number);
}
} catch (Exception ex) {
System.out.println("error" + ex);
}
}
}