数据库表里字段怎么也更新不了
wdf10 2007-04-26 05:41:49 我需要通过调用我自己写的更新函数来更新数据库的一个字段,怎么也更新不了,我把参数写死了,也更新不了,可是单独在PL/SQl Developer 里执行那个sql语句就行. 下面是代码,请指教!谢谢!
public void modifyDocumentContent(long docid, String item_name,String item_value,Connection conn) {
System.out.println("coming=========="+docid+"$ $"+item_name+"$ $"+"$ $"+item_value);
String sql = "update mocha_fe_document_content set item_value='2007-03-19' where document_id=7394 and item_name='daimakudongjie'";
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(sql);
// ps.setString(1, "2007-04-30");
// ps.setLong(2, c);
// ps.setString(3, "daimakudongjie");
int b = ps.executeUpdate();
System.out.println("bbbbb: "+b);
System.out.println("executed==============================!!");
} catch (SQLException e) {
e.printStackTrace();
logger.error("DocumentManager:Error---------" + e.getMessage());
} finally {
try {
if(ps!=null){
ps.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}