ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juanpe <jupe...@gmail.com>
Subject Problem with DB2, IBATIS and IBM Updatable Cursors
Date Thu, 28 Jul 2005 10:13:56 GMT
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