Retriving data from MySQL database in Java -


i have written method in java retrieves data mysql database , adds list. method returns null values few of ids although there data in database.

here code:

public static list getposttime(int id) {    list<timestamp> time = new arraylist();      try {         preparedstatement ps;         resultset rs;         connection con;          con = dbconnection.getdbconnection();         string querytime = "select created tbl_posts_98 `makerid` = \'" + id + "\'";          ps = con.preparestatement(querytime);         rs = ps.executequery();         while (rs.next()) {             time.add(rs.gettimestamp(1));         }      } catch (java.lang.throwable t) {         //system.out.println(t.getclass().getname()); //this'll tell class has been thrown         t.printstacktrace(); //get stack trace     }     return time; }   

thank in advance.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -