Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: JDBC: getMoreResults() versus rs.next() & autoGeneratedKeys Date: Sat, 21 Dec 2013 17:14:16 +0100 Lines: 46 Message-ID: References: <52b4dbf5$0$304$14726298@news.sunsite.dk> <52b5bae0$0$300$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: individual.net 4hzpmeBY+0bC9U4uF+VIjweRsXZtOVN/i2bYErENUUudeU/LQ= Cancel-Lock: sha1:/ED0jcPyIk7Tze7Rqx5zEbq6DcQ= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <52b5bae0$0$300$14726298@news.sunsite.dk> Xref: csiph.com comp.lang.java.programmer:27015 On 21.12.2013 16:59, Arne Vajh=F8j wrote: > On 12/21/2013 4:15 AM, Robert Klemme wrote: >> On 21.12.2013 01:08, Arne Vajh=F8j 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 readi= ng >>>> 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. >> >> That feature is not limited to stored procedures. You can have multip= le >> statements executed with a single Statement. Consequently you get >> multiple results. > > The common interpretation of JDBC spec and API docs is that > multiple SQL statements in single JDBC statement object is > not supported. > > And it fact it typical does not work. > > Only exception I know about is MySQL where you can specify > allowMultiQueries=3Dtrue in the connection string to enable the > feature. Oracle IIRC as well. Cheers robert