Thread: record lock
View Single Post

   
  #7 (permalink)  
Old 02-26-2008, 05:04 PM
Fan Ruo Xin
 
Posts: n/a
Default Re: record lock


"xixi" <dai_xi@yahoo.com> wrote in message
news:c0f33a17.0402101323.2856b57f@posting.google.c om...
> hi, i have change the program to this
>
> conn.setTransactionIsolation(4);
>
> stm =
> conn.createStatement(
> ResultSet.TYPE_SCROLL_SENSITIVE,
> ResultSet.CONCUR_UPDATABLE);
>
> sqlStr = "select id, imno08, imcd90, arno15 from NJIPD.IMLMLNB1
> WHERE id=42";
>
>
> tmpCursor = stm.executeQuery(sqlStr);
>
> tmpCursor.next();
> sqlStr = "select id, imno08, apno01, prno02 from NJIPD.IMPWSBS
> WHERE imno08='3M' ORDER BY imno08 ASC, apno01 ASC, prno02 ASC";
> Statement stmt = conn.createStatement(
> ResultSet.TYPE_SCROLL_INSENSITIVE,
> ResultSet.CONCUR_READ_ONLY);
>
> ResultSet cursor = stmt.executeQuery(sqlStr);
> if (!cursor.isBeforeFirst())
> cursor.close();
>
> even i use RS isolation, once one resultset close, it will close the
> row U lock opened by another resultset. i don't want that . please
> help


That is strange. IIRC, this is because of cursor.isBeforeFirst(). Can you
try to use next(), other than isBeforeFirst()?
ResultSet cursor = stmt.executeQuery(sqlStr);
cursor.next();
cursor.close();

Does this release the Row (U) lock of tmpCursor result set?



Reply With Quote