| 发表于:2007-01-11 17:19:53 楼主 |
突然发现我的db2中的表如果是出于查询状态,那么再update就过不去了,在调试状态就停在update语句上不动了。而且表锁了。开发工具是websphere 。那位大侠知道是什么原因? connection cn=null; initialcontext ctx=null; datasource ds=null; statement stmt=null; resultset rs=null; statement tempstmt=null; resultset temprs=null; ctx = new initialcontext(); ds=(datasource) ctx.lookup( "wmsmngjndi "); cn=ds.getconnection(); stmt=cn.createstatement(); tempstmt=cn.createstatement(); string tmpstr= " "; rs=stmt.EXECutequery( "select * from table1 "); while(rs.next()){ tmpstr=rs.getstring( "r1 "); tempstmt.EXECuteupdate( "update table1 set stat= 'y ' where r1= ' "+tmpstr+ " ' "); } 在调试状态下当运行到tempstmt.EXECuteupdate( "update table1 set stat= 'y ' where r1= ' "+tmpstr+ " ' ");就不动了。 |
|
|
|
|