File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Returning of More than one resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Returning of More than one resultset" Watch "Returning of More than one resultset" New topic

Returning of More than one resultset

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hello Javaranch!Can any one please inform me under what circumstances does the execute method return more than one resultset.(It is mentioned in the api for the execute ethod of PreparedStatement).If more than one resultset is returned how to handle them.kindly give the dcode snippet which does this.
Thanking you in advance.
Paul Caudle
Ranch Hand

Joined: Jun 08, 2000
Posts: 64
Hi there, clkanth, I think the api is referring to handling more than one result, rather than more than one ResultSet.
The execute method can support any sql including ones which alter multiple tables in the database, and will return true or false according to if the changes to the database were successful or not. The internal workings of this method allow
(somehow, I have no idea how) verification of changes to each of these tables. This is what the api means by multiple results. By the time the method returns a boolean, it has combined the results (successes or failures of each part of the SQL) into either one big yes or one big no.
That is my view of how the execute method works and may not be what is truly going on but from looking at the api spec that is what it looks like to me.
hope that helps,
Ray Marsh
Ranch Hand

Joined: Jan 12, 2000
Posts: 458
"clkanth", take a look at this link:

Anxiety does not empty tomorrow of its sorrows, but only empties today of its strength. – Charles Spurgeon
Monty Ireland
Ranch Hand

Joined: Oct 03, 2000
Posts: 161
Point#1 Executing more than on sql statement at the same time.
Thus, you may have more than one ResultSet available to process at the same time.
Point#2 I think the JDBC2.0 standard. Extended features...
Allows a Stored Procedure to return more tha one result set.
Very advanced stuff... Not for the faint of heart...
Please correct me if i am wrong
Any other opinions?
We learn more from our mistake's than fom our success's.

Multi Platform Database Developer & DBA on E.S.T.
I agree. Here's the link:
subject: Returning of More than one resultset
It's not a secret anymore!