java - SQL query display onto window -


i'm trying output sql query results onto window of sorts when button clicked when clicked displays "org.hsqlb.jdbc.jdbcresultset@75fbe2c7", dont know if it's relative number @ end changes database connection works

jbutton btnreview = new jbutton("review seller requests"); btnreview.addactionlistener(new actionlistener() {     public void actionperformed(actionevent arg0) {         try {             string query = "select email seller_requests";             preparedstatement pst = connect.preparestatement(query);             rs = pst.executequery();              if(rs.next()) {                 joptionpane.showmessagedialog(null, rs);             }              pst.close();              } catch (exception e) {                 e.printstacktrace();             }         }     }); 

can joptionpane used or there way?

to view results, need appropriate column value resultset object after calling next method. can use resultset#getstring(int columnindex) this:

if(rs.next()) {     string email = rs.getstring(1);  // column index starts @ 1, not zero.     // display email } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -