🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8506

Re: another new Connection for two Resul?

#8506
From: Torsten Welches
Date: Fri, 16 Mar 2001 06:51
41 lines
1976 bytes
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: <3ab1b7e4$1_2@dnews>
Path: arc1-ca.pugleaf.net!pubnews.netcom.net.uk!diablo.netcom.net.uk!netcom.net.uk!news.tele.dk!128.230.129.106!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!207.105.83.65
References: <3ab17350_1@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:17 PST
From: "Torsten Welches" <torsten.welches@who.cares.netcologne.de>
Sender: "Torsten Welches" <torsten.welches@who.cares.netcologne.de>
Reply-To: "Torsten Welches" <torsten.welches@who.cares.netcologne.de>
Subject: Re: another new Connection for two Resul?
Newsgroups: borland.public.jbuilder.java.language
X-User-Info: 193.158.55.74 193.158.55.74    
References:  <3ab17350_1@dnews> 
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3ab1b7e4$1_2@dnews>
Date: 15 Mar 2001 22:51:16 -0800
X-Trace: 15 Mar 2001 22:51:16 -0800, 207.105.83.65
Lines: 42
Path: arc1-ca.pugleaf.net!pubnews.netcom.net.uk!diablo.netcom.net.uk!netcom.net.uk!news.tele.dk!128.230.129.106!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!207.105.83.65