If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > call to DB2 stored procedure from Hibernate returns null

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-17-07, 00:42
av_domain av_domain is offline
Registered User
 
Join Date: Dec 2007
Posts: 6
Question call to DB2 stored procedure from Hibernate returns null

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 = HibernateApp.getHibernateSession().connection().pr epareCall("{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~
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On