By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,007 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,007 IT Pros & Developers. It's quick & easy.

Resultset returns null while calling a DB2 stored procedure using hibernate

P: 2
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....................

CallableStatement stmt3 = EyeHibernateApp.getHibernateSession().connection() .prepareCall("{call answers_select_id( ? )}");

stmt3.setString(1,20);
stmt3.execute();

ResultSet rs1 = stmt3.getResultSet();
System.out.println("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~
Dec 17 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.