Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!fx09.iad.POSTED!not-for-mail From: Arved Sandstrom User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: JDBC: getMoreResults() versus rs.next() & autoGeneratedKeys References: <52b4dbf5$0$304$14726298@news.sunsite.dk> In-Reply-To: <52b4dbf5$0$304$14726298@news.sunsite.dk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Lines: 30 Message-ID: <1yltu.41101$TA.8682@fx09.iad> X-Complaints-To: abuse@newsgroups-download.com NNTP-Posting-Date: Sat, 21 Dec 2013 18:59:09 UTC Organization: Public Usenet Newsgroup Access Date: Sat, 21 Dec 2013 14:59:08 -0400 X-Received-Bytes: 2002 X-Received-Body-CRC: 3908362933 Xref: csiph.com comp.lang.java.programmer:27022 On 12/20/2013 08:08 PM, Arne Vajhøj wrote: > On 12/20/2013 9:07 AM, Andreas Leitgeb wrote: >> I have to write code to execute runtime-specified SQL-statements, >> and there are two things that I wasn't able to understand from reading >> the javadocs: >> >> 1.) >> When would one call .getMoreResults() on a statement instead of just >> another rs.next() on the first one (obtained from stmnt.getResultSet())? >> Are these equivalent, or is there really a concept of multiple >> ResultSets, >> each of which has its own independent set of rows? > > Yes. > > Some databases support stored procedures returning multiple > result sets. [ SNIP ] This might just be me, but I dislike the entire idea. I am aware of the possibility, I've never used it. To me a stored proc (SP) should adhere to the same principles as functions or procedures - you try to simplify your components (and your application) by not having them do multiple things (side-effects, overly complex return values etc). AHS -- When a true genius appears, you can know him by this sign: that all the dunces are in a confederacy against him. -- Jonathan Swift