Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last ResultSet in a PreparedStatement

Status
Not open for further replies.

Stedo

Programmer
Sep 15, 2005
44
SE
hi,

When executing a prepared statement, how do I get the returned last ResultSet?

I have looked at getMoreResults() method however this only tells me that the result set was the last one after it has been closed.

Can anyone help?

Thanks
Steve
 
From my point of wiew, the idea of a PreparedStatement and the ResultSet itself, is to establish a way to gather data, keeping the connection and hiding the details.

But this data is gathered as needed, ie, you know nothing about the next data. Why? Because to know you need to retrieve it and that's not the idea.

Could be wrong, though, I'm not an expert on this issue.

cheers,
Dian
 
Are you asking how to get the last record in a ResultSet ?

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
hi,

The problem is like this, I have a stored procedure in MySQL which executes a number of SELECT statements. The stored procedure executes fine. The problem seems to be that when I try to obtain the ResultSet after execution I revceive the ResultSet for the SELECT statment in the stored procedure which executed first, when what I want is the ResultSet for the last executed SELECT statement in the stored procedure. Therefore I need to know when I hit the last ResultSet.

Thanks for your help
Steve
 
Well that sounds like a problem in the SP, not the JDBC end ... you need to return the appropriate ResultSet from the SP.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
hi,

Sorted the problem. In my MySQL procedures you have to make a SELECT ... INTO if you don't want the result set returned.

Thanks
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top