Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Accessing multiple resultsets  RSS feed

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All;

Here's some wierd problem I'm facing while handeling multiple resultsets from stored procedure.

I've a stored procedure that returns multiple cursors. And I access them
in my code. After accessing the first resultset when I want to access next
one. As usual I code it like

CallableStatement.getMoreResults();
ResultsetObj=CallableStatement.getResultset();

But I get ResultsetObj as null...and I know that stored produre returns valid data for 2nd cursor...as I have confirmed it by running the procedure in stored procedure builder.
I'm using IBM DB2 7.0

I'll be very glad, If anybody can give me the clarification.
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A couple of questions and suggestions:

What happens if you swap the cursors round in your SP? Does the first ResultSet then contain the right results?

I've experienced problems in the past with Sybase drivers whereby if you make any changes to the statement's parameters after having executed it (or even access output parameters, I think) then the statement loses (or resets) its ResultSet. Could that be your problem?

Is there a logical difference between an empty ResultSet and a null one, i.e. if your query returns zero rows, is ResultSet null or just created empty? Obviously I realise there's a physical (Java) difference.

Jules
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!