• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getting empty resultset

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using Sybase and Java 1.4. The program is executing stored procedure which returns resultset.

Now when I try to execute the stored proc from RapidSQL it is returning me result, but when executed from Java program it gives empty resultset.

It is not giving any exception or error. I tried checking resultset size in Java and it is returning zero.Here is the code snippet,

m_objCallableStmt = p_objConn.prepareCall(P_GET_PRC_CHG_RPT);
m_objCallableStmt.setDate(1, dbDate);
m_objCallableStmt.setDouble(2, m_dblThrhdVal);

m_objRS = m_objCallableStmt.executeQuery();

int cnt =0;
while(m_objRS.next()){
cnt++;
}
log.debug("Cont of resultset is :"+cnt);

Please let me know what is causing this issue here.

Thanks in advance.

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer isn't complicated: your query doesn't return any records.

If you want to know why not, you would have to examine the query and the parameters you passed to it. (Neither of which we can see.)
 
Hd Desai
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

Thank you for replying.

As mentioned I am execuuting stored procedure and parameters are 2012-03-06 and 0.12 respectively.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay. So your problem is solved, then. Would you like me to mark it as "Resolved"?
 
Hd Desai
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wish it had :-(

It is still unsolved ,I said thank you because you gave some time to read and reply. But unfortunately it is not solved yet.
 
Ranch Hand
Posts: 247
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your Stored Procedure returns more than one ResultSet (i.e, if Stored Procedure contain more than one "select" query statements), use execute() method.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hd Desai wrote:It is still unsolved ,I said thank you because you gave some time to read and reply. But unfortunately it is not solved yet.



May I ask why you posted this problem here?

Normally when people post their problems on these forums, it's because they want other people to help them solve those problems. But you don't appear to want any help. Or at least if you do, you certainly aren't acting like it.
 
Hd Desai
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul, please dont read my post if you are not interested in.I know why I am here and what is problem.

There are people who are interested in help people, I can better ask them.

@Ram : My stored procedure is having only 1 select with multiple joins. And i verified it is not returning multiple resultsets.
 
Ram Narayan.M
Ranch Hand
Posts: 247
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try changing the Sybase JDBC Driver if you are referring to upgraded Sybase DB version with very old Sybase JDBC Driver.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hd Desai wrote:There are people who are interested in help people, I can better ask them.



I'm suggesting that you could do it more effectively than you are doing it now. I already suggested that looking at the query would be an important part of solving the problem. To be more clear, I'm suggesting that you should post the query here so that people could look at it.
 
Ranch Hand
Posts: 344
Oracle Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you take out the query from the stored procedure, plug in the 2 argument values ("hard code" them in the query) and run it manually to see if it returns anything. That's where I would start.
 
roses are red, violets are blue. Some poems rhyme and some are a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic