ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: Problem with DB2, IBATIS and IBM Updatable Cursors
Date Thu, 28 Jul 2005 12:20:19 GMT
With a stored procedure, it would be a snap.

Larry


On 7/28/05, Juanpe <jupecal@gmail.com> wrote:
> 
> Hello!
> 
> I have a problem with IBM Updatable Cursors (DB2), I need to associate
> a cursor to a select sentence, to use it in another sentence (an
> update sentence). The code would be the following one (SELECT FOR
> UPDATE) in Java:
> 
> mCon.setAutoCommit(false);
> stmt = mCon.createStatement();
> stmt.setCursorName("UPDATABLESTATEMENT");
> stmt2 = mCon.createStatement();
> SQL = "SELECT * FROM T1 FOR UPDATE OF cod_number";
> rs = stmt.executeQuery(SQL);
> rs.next();
> SQL2 = "UPDATE T1 set cod_number = cod_number + 1 WHERE CURRENT OF
> UPDATABLESTATEMENT";
> stmt2.executeUpdate(SQL2);
> stmt.close();
> stmt2.close();
> mCon.commit();
> mCon.close();
> 
> Is possible to do this using Ibatis?
> 
> Thanks in advance.
> 
> JP
>

Mime
View raw message