如题 prepareStatement(String sql)
四个参数,两个3个string型,一个时间戳型
sql 语句 是这样的 update (表名) set 字段=?,字段=?,字段=? where 字段=?
setString(1,null)
setString(2,null)
setTimestamp(3,null)
setString(4,null)eclipse 执行到 executeUpdate()的时候卡死
只是有时候会卡死,有时候又是正常得,真是怪事了
四个参数,两个3个string型,一个时间戳型
sql 语句 是这样的 update (表名) set 字段=?,字段=?,字段=? where 字段=?
setString(1,null)
setString(2,null)
setTimestamp(3,null)
setString(4,null)eclipse 执行到 executeUpdate()的时候卡死
只是有时候会卡死,有时候又是正常得,真是怪事了
你看下是不是where条件写的不严密,导致update执行了N多数据.
public void updateLockedBy(String aStringId,String usernameLockedBy){
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
debug("$$perform::updateLockedBy()::***param:: StringId::"+aStringId+"param ::usernameLockedBy="+usernameLockedBy);
try {
conn = getEsplDBConnection();
pstmt = conn.prepareStatement(EsplSharedResources.getEsplQuery("UPDATE_LOCKED_BY"));
pstmt.setString(4, aStringId);
pstmt.setTimestamp(3, new java.sql.Timestamp(System.currentTimeMillis()));
pstmt.setString(2, usernameLockedBy);
debug("$$Test::execeuteUpdate()::11111111111111111111111111");
pstmt.setString(1,"L");
pstmt.execute();
debug("The check count Query :: Steam :::: " + EsplSharedResources.getEsplQuery("UPDATE_LOCKED_BY"));
debug("$$Test::execeuteUpdate()::22222222222222222222222222");
} catch (ESPLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
try {
closeRS(rs);
closePS(pstmt);
closeConnection(conn);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}红色的一行卡死
pstmt.setString(2, usernameLockedBy);
pstmt.setString(1,"L");
debug("The check count Query :: Steam :::: " + EsplSharedResources.getEsplQuery("UPDATE_LOCKED_BY"));
pstmt.execute();
debug("$$Test::execute()::22222222222222222222222222");程序停在execute()这行就再也不动了,也没有报异常, 根据数据库记录显示,update语句没执行成功!!!
这条语句是不是有问题呀。
prepareStatement对象或者Connection对象所以一执行到这里会卡死..我以前也碰过这种问题..仔细检查下吧
prepareStatement对象或者Connection对象所以一执行到这里会卡死..我以前也碰过这种问题..仔细检查下吧