Article View: borland.public.jbuilder.java.language
Article #8511Re: another new Connection for two Resul?
From: Stephen Zeng
Date: Fri, 16 Mar 2001 08:07
Date: Fri, 16 Mar 2001 08:07
52 lines
2397 bytes
2397 bytes
Dear Torsten,
You see my sample I do create statement for each ResultSet, but there is a
error: Connection is busy with results for another Statment? Do you know
why?
"Torsten Welches" <torsten.welches@who.cares.netcologne.de> wrote in message
news:3ab1b7e4$1_2@dnews...
>
> Stephen,
>
> you don't need two Connections, but two Statements. One Statement
> can only serve one ResultSet.
> You might also want to verify if what your are after isn't doable
> with *one* SQL statement - join, subselect and so on.
>
> Torsten
>
> "Stephen Zeng" <chinafax1@cmmail.com> wrote:
> > Connection
con=DriverManager.getConnection("jdbc:odbc:expresso","sa","");
> > Statement sqlstr=con.createStatement();
> > Statement trasql=con.createStatement();
> >
> > ResultSet firstrs=sqlstr.executeQuery("....");
> >
> > while (firstrs.next()) {
> >
> > System.out.println(firstrs.getString(1));
> >
> >
> > // next result set
> > ResultSet secondrs=sqlstr.executeQuery("...");
> >
> > while (secondrs.next()) {
> > System.out.println(secondrs.getString(1));
> >
> >// error: Connection is busy with results for another Statment,
> >// Does it means I need create New Connection for each ResultSet? if
that
> >is the case,
> >// it will occupy large Server resource?
> >// Or is there any better method?
> >
> > }
> >
> > }
> >
> >
> >
> >
>
Technical Details
Message-ID:
<3ab1ca4d_2@dnews>Path:
arc1-ca.pugleaf.net!pubnews.netcom.net.uk!diablo.netcom.net.uk!netcom.net.uk!newsfeed.icl.net!newsfeed00.sul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp1.njy.teleglobe.net!teleglobe.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews!211.159.29.2References:
<3ab17350_1@dnews> <3ab1b7e4$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,706e71a4e5ab8522 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-17 07:55:21 PST From: "Stephen Zeng" <chinafax1@cmmail.com> Newsgroups: borland.public.jbuilder.java.language References: <3ab17350_1@dnews> <3ab1b7e4$1_2@dnews> Subject: Re: another new Connection for two Resul? Date: Fri, 16 Mar 2001 16:07:02 +0800 Lines: 54 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 NNTP-Posting-Host: 211.159.29.2 Message-ID: <3ab1ca4d_2@dnews> X-Trace: 16 Mar 2001 00:09:49 -0800, 211.159.29.2 Path: arc1-ca.pugleaf.net!pubnews.netcom.net.uk!diablo.netcom.net.uk!netcom.net.uk!newsfeed.icl.net!newsfeed00.sul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp1.njy.teleglobe.net!teleglobe.net!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews!211.159.29.2