File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting empty resultset

 
Hd Desai
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • 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.

 
Paul Clapham
Sheriff
Pie
Posts: 20177
25
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Pie
Posts: 20177
25
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Ram Narayan.M
Ranch Hand
Posts: 247
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Pie
Posts: 20177
25
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Pie
Posts: 20177
25
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Koen Aerts
Ranch Hand
Posts: 344
Java Linux Oracle
  • 1
  • Mark post as helpful
  • send pies
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic