java - Retrieve timestamp from Mysql -


i have java mvc model.which has timestamp 1 of db value inserted db.i have declared data type timestamp in db,now problem if try retrieve showing null values & can not represented java.sql.timestamp

statement :

pstmt = con.preparestatement("select timestamp, nid id=?"); pstmt.setdouble(1, nidev);         rs = pstmt.executequery();          if(rs.next())         {               timebean.sethbtimestamp(rs.gettimestamp("timestamp"));          }  

bean class:

private timestamp hbtimestamp;  public timestamp gethbtimestamp() { return hbtimestamp; } public void sethbtimestamp(timestamp hbtimestamp) { this.hbtimestamp = hbtimestamp; } 

mydb value inserted :2015-05-15 13:54:53

output: value '0000-00-00 00:00:00' can not represented java.sql.timestamp

remove , looks this

select `timestamp` nid id=? 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -