db2 timestamp 字段插到数据库时报错SQLCODE=-180
DB2 SQL Error: SQLCODE=-180, SQLSTATE=22007, SQLERRMC=null, DRIVER=3.59.81
代码如下.请问是怎么回事啊?
java.util.Date d = new java.util.Date();
long time = d.getTime();
java.sql.Timestamp ts = new Timestamp(time);
if (nanos > 999999)
nanos = 0;
nanos += 1000;
ts.setNanos(nanos);
time_stamp = ts.toString();
pstmt.setTimestamp(parmCt, ts);
这个是说你timestamp字符串语法不对啊,检查一下你执行之前完整sql语句的格式
在command editor用timestamp(trim(char('2012-10-31 15.34.53.003013')))
就报这个错,用timestamp(trim(char('2012-10-31-15.34.53.003013')))没问题.
java.sql.Timestamp的format怎么改成yyyy-mm-dd-hh.mm.ss.MMMMMM?
String your_date = "2012-10-31-15.34.53.003013";
java.util.Date d = new SimpleDateFormat("yyyy-mm-dd-HH.mm.ss.ffffff").parse(your_date);
java.sql.Timestamp t = new java.sql.Timestamp(d);