Hi All ,
I am trying to call a db2 stored proc with cursor open from my java code but it always returns me null results though it executes fine when I call the procedure from the command line
Java code........... .........
CallableStateme nt stmt3 = EyeHibernateApp .getHibernateSe ssion().connect ion().prepareCa ll("{call answers_select_ id( ? )}");
stmt3.setString (1,20);
stmt3.execute() ;
ResultSet rs1 = stmt3.getResult Set();
System.out.prin tln("rs1 " + rs1); --> returns null
procedure-------------
CREATE PROCEDURE answers_select_ id (IN question_id bigint )
P1:BEGIN
DECLARE cursor1 CURSOR WITH RETURN TO CLIENT FOR
SELECT a.answer_id from answers as a where a.question_id = question_id;
open cursor1;
END P1;
I am using the same java code with mysql stored procs . It works fine there but I assume open cursors in db2 stored proc is causing the problem . If I can help it , I need to maintain the same java code for mysql ad db2 . Please help me ...
Thanks,
Av~
I am trying to call a db2 stored proc with cursor open from my java code but it always returns me null results though it executes fine when I call the procedure from the command line
Java code........... .........
CallableStateme nt stmt3 = EyeHibernateApp .getHibernateSe ssion().connect ion().prepareCa ll("{call answers_select_ id( ? )}");
stmt3.setString (1,20);
stmt3.execute() ;
ResultSet rs1 = stmt3.getResult Set();
System.out.prin tln("rs1 " + rs1); --> returns null
procedure-------------
CREATE PROCEDURE answers_select_ id (IN question_id bigint )
P1:BEGIN
DECLARE cursor1 CURSOR WITH RETURN TO CLIENT FOR
SELECT a.answer_id from answers as a where a.question_id = question_id;
open cursor1;
END P1;
I am using the same java code with mysql stored procs . It works fine there but I assume open cursors in db2 stored proc is causing the problem . If I can help it , I need to maintain the same java code for mysql ad db2 . Please help me ...
Thanks,
Av~