java - i want to add a whole string column in arraylist from mysql and separate by comma, and display the array list -


private void jbutton1actionperformed(java.awt.event.actionevent evt) {     try {         class.forname("com.mysql.jdbc.driver");         connection con = drivermanager.getconnection("mysql:jdbc:///viru", "root", "");         string query = "select stations *  trains";         preparedstatement pst = con.preparestatement(query);          resultset rs = pst.executequery();          while (rs.next()) {             string s = rs.getstring("stations");             stationlist.add(s);              stationlist = new arraylist(arrays.aslist(s.split(",")));          }         (string value : stationlist) {             system.out.println(value);         }     } catch (exception e) {      } 


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -