Lock on a table with nested select
mc1976Jul 15 2003 — edited Jul 15 2003Hi to all,
I've encountered a strange problem with a nested select query. The code
is like the following:
String sql = "SELECT A.field1,A.field2 AS CODE FROM MYTABLE A WHERE A.field2 = ? AND field1 in (SELECT B.x FROM SECONDTABLE B WHERE B.y= ?) ORDER BY A.field2";
PreparedStatement ps = connection.prepareStatement(sql);
ps.setXXX(1,value1);
ps.setXXX(2,value2);
ResultSet rs = ps.executeQuery();
The query works fine, but even after I've close the connection with the db (IBM DB2 in WebSphere enviroment) I just cannot execute insert or delete , 'cause table A results locked.
Any suggestions ?
Thanx in advance...