How can I display a list of data taken from a database graphically with java (jdbc)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I display a list of data taken from a database graphically with java (jdbc)?

hello community, someone would know how I can do to display in the form of a list of data that I extracted from a mysql database with java (jdbc). For example here are lines of code which allows to extract a data : Statement state=con.createStatement(); String rq="select name from table"; state.execute(rq); I am designing an application with a graphical interface. with the lines of code above, we can see that the connection to the database works and that the query gives a result on the terminal. But if I want to build a list with the data taken from the database and display it graphically, how can I?

23rd Mar 2022, 6:36 PM
Romaric
3 Answers
0
the code above was missing lines of code: ResultSet rs=state.exexuteQuery(rq); While(rs.next()){ String h=rs.getString(1); }
23rd Mar 2022, 6:41 PM
Romaric
0
And i display h with : System.out.println(h); to see that the connection is working!. It's okay on the terminal but how can i create a list with these data and display them graphically?
23rd Mar 2022, 6:44 PM
Romaric
0
FF9900 thanks
23rd Mar 2022, 11:39 PM
Romaric