Re: quick question about PreparedStatements

Lists: pgsql-jdbc
From: Felipe Schnack <felipes(at)ritterdosreis(dot)br>
To: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: quick question about PreparedStatements
Date: 2003-07-24 18:55:31
Message-ID: 20030724155531.2d3350d0.felipes@ritterdosreis.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Can I use a single PreparedStatement to create various ResultSets and get data from all of them at the same time?

--

/~\ The ASCII Felipe Schnack (felipes(at)ritterdosreis(dot)br)
\ / Ribbon Campaign Analista de Sistemas
X Against HTML Cel.: 51-91287530
/ \ Email! Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter(at)ritterdosreis(dot)br
Fone: 51-32303341


From: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
To: "pgsql-jdbc (at) postgresql (dot) org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: quick question about PreparedStatements
Date: 2003-07-25 08:06:58
Message-ID: 20030725090658.A20737@bacon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc


On 24/07/2003 19:55 Felipe Schnack wrote:
> Can I use a single PreparedStatement to create various ResultSets and
> get data from all of them at the same time?

I don't think so. The Javadoc for Statement says:

"By default, only one ResultSet object per Statement object can be open at
the same time"

To me, this suggests that some db's may allow multiple ResultSets per
Statement but that such extensions would be non-portable. Looking at the
source for AbstactJdbc1Statement, it has

protected java.sql.ResultSet result = null;

So it looks like PG has the one ResultSet to one Statement implementation.

HTH

--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+


From: Felipe Schnack <felipes(at)ritterdosreis(dot)br>
To: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
Cc: "pgsql-jdbc (at) postgresql (dot) org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: quick question about PreparedStatements
Date: 2003-07-25 12:18:59
Message-ID: 20030725091859.224aa98e.felipes@ritterdosreis.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

I don't know, maybe I just don't understand something about Prep. Statements, but why they have a reference to a ResultSet it has created? To me make more sense the opposite, the ResultSets reference the Statement...
Anyone can confirm I can only have one resultset per statement?

On Fri, 25 Jul 2003 09:06:58 +0100
Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk> wrote:

>
> On 24/07/2003 19:55 Felipe Schnack wrote:
> > Can I use a single PreparedStatement to create various ResultSets and
> > get data from all of them at the same time?
>
> I don't think so. The Javadoc for Statement says:
>
> "By default, only one ResultSet object per Statement object can be open at
> the same time"
>
> To me, this suggests that some db's may allow multiple ResultSets per
> Statement but that such extensions would be non-portable. Looking at the
> source for AbstactJdbc1Statement, it has
>
> protected java.sql.ResultSet result = null;
>
> So it looks like PG has the one ResultSet to one Statement implementation.
>
> HTH
>
> --
> Paul Thomas
> +------------------------------+---------------------------------------------+
> | Thomas Micro Systems Limited | Software Solutions for the Smaller
> Business |
> | Computer Consultants |
> http://www.thomas-micro-systems-ltd.co.uk |
> +------------------------------+---------------------------------------------+
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

--

/~\ The ASCII Felipe Schnack (felipes(at)ritterdosreis(dot)br)
\ / Ribbon Campaign Analista de Sistemas
X Against HTML Cel.: 51-91287530
/ \ Email! Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter(at)ritterdosreis(dot)br
Fone: 51-32303341


From: Barry Lind <blind(at)xythos(dot)com>
To: Felipe Schnack <felipes(at)ritterdosreis(dot)br>
Cc: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>, "pgsql-jdbc (at) postgresql (dot) org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: quick question about PreparedStatements
Date: 2003-08-07 02:57:37
Message-ID: 3F31C021.2020501@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Yes you can only have one active result set per statement.

--Barry

Felipe Schnack wrote:
> I don't know, maybe I just don't understand something about Prep. Statements, but why they have a reference to a ResultSet it has created? To me make more sense the opposite, the ResultSets reference the Statement...
> Anyone can confirm I can only have one resultset per statement?
>
> On Fri, 25 Jul 2003 09:06:58 +0100
> Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk> wrote:
>
>
>>On 24/07/2003 19:55 Felipe Schnack wrote:
>>
>>> Can I use a single PreparedStatement to create various ResultSets and
>>>get data from all of them at the same time?
>>
>>I don't think so. The Javadoc for Statement says:
>>
>>"By default, only one ResultSet object per Statement object can be open at
>>the same time"
>>
>>To me, this suggests that some db's may allow multiple ResultSets per
>>Statement but that such extensions would be non-portable. Looking at the
>>source for AbstactJdbc1Statement, it has
>>
>>protected java.sql.ResultSet result = null;
>>
>>So it looks like PG has the one ResultSet to one Statement implementation.
>>
>>HTH
>>
>>--
>>Paul Thomas
>>+------------------------------+---------------------------------------------+
>>| Thomas Micro Systems Limited | Software Solutions for the Smaller
>>Business |
>>| Computer Consultants |
>>http://www.thomas-micro-systems-ltd.co.uk |
>>+------------------------------+---------------------------------------------+
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 3: if posting/reading through Usenet, please send an appropriate
>> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>> message can get through to the mailing list cleanly
>
>
>


From: Felipe Schnack <felipes(at)ritterdosreis(dot)br>
To: Barry Lind <blind(at)xythos(dot)com>
Cc: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>, "pgsql-jdbc (at) postgresql (dot) org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: quick question about PreparedStatements
Date: 2003-08-07 18:01:16
Message-ID: 20030807150116.166c4a93.felipes@ritterdosreis.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hm... ok, but (just curious) this is a backend or driver limitation?

On Wed, 06 Aug 2003 19:57:37 -0700
Barry Lind <blind(at)xythos(dot)com> wrote:

> Yes you can only have one active result set per statement.
>
> --Barry
>
> Felipe Schnack wrote:
> > I don't know, maybe I just don't understand something about Prep. Statements, but why they have a reference to a ResultSet it has created? To me make more sense the opposite, the ResultSets reference the Statement...
> > Anyone can confirm I can only have one resultset per statement?
> >
> > On Fri, 25 Jul 2003 09:06:58 +0100
> > Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk> wrote:
> >
> >
> >>On 24/07/2003 19:55 Felipe Schnack wrote:
> >>
> >>> Can I use a single PreparedStatement to create various ResultSets and
> >>>get data from all of them at the same time?
> >>
> >>I don't think so. The Javadoc for Statement says:
> >>
> >>"By default, only one ResultSet object per Statement object can be open at
> >>the same time"
> >>
> >>To me, this suggests that some db's may allow multiple ResultSets per
> >>Statement but that such extensions would be non-portable. Looking at the
> >>source for AbstactJdbc1Statement, it has
> >>
> >>protected java.sql.ResultSet result = null;
> >>
> >>So it looks like PG has the one ResultSet to one Statement implementation.
> >>
> >>HTH
> >>
> >>--
> >>Paul Thomas
> >>+------------------------------+---------------------------------------------+
> >>| Thomas Micro Systems Limited | Software Solutions for the Smaller
> >>Business |
> >>| Computer Consultants |
> >>http://www.thomas-micro-systems-ltd.co.uk |
> >>+------------------------------+---------------------------------------------+
> >>
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 3: if posting/reading through Usenet, please send an appropriate
> >> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> >> message can get through to the mailing list cleanly
> >
> >
> >
>
>

/~\ The ASCII Felipe Schnack (felipes(at)ritterdosreis(dot)br)
\ / Ribbon Campaign Analista de Sistemas
X Against HTML Cel.: 51-91287530
/ \ Email! Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter(at)ritterdosreis(dot)br
Fone: 51-32303341


From: Barry Lind <blind(at)xythos(dot)com>
To: Felipe Schnack <felipes(at)ritterdosreis(dot)br>
Cc: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>, "pgsql-jdbc (at) postgresql (dot) org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: quick question about PreparedStatements
Date: 2003-08-07 18:10:05
Message-ID: 3F3295FD.5040204@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Felipe,

Sort of both. If you are not using cursors then the limitation is in
the driver, if you are using cursors or future use of the v3 fe/be
protocol then the limitation is on the server.

thanks,
--Barry

Felipe Schnack wrote:
> Hm... ok, but (just curious) this is a backend or driver limitation?
>
> On Wed, 06 Aug 2003 19:57:37 -0700
> Barry Lind <blind(at)xythos(dot)com> wrote:
>
>
>>Yes you can only have one active result set per statement.
>>
>>--Barry
>>
>>Felipe Schnack wrote:
>>
>>> I don't know, maybe I just don't understand something about Prep. Statements, but why they have a reference to a ResultSet it has created? To me make more sense the opposite, the ResultSets reference the Statement...
>>> Anyone can confirm I can only have one resultset per statement?
>>>
>>>On Fri, 25 Jul 2003 09:06:58 +0100
>>>Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk> wrote:
>>>
>>>
>>>
>>>>On 24/07/2003 19:55 Felipe Schnack wrote:
>>>>
>>>>
>>>>> Can I use a single PreparedStatement to create various ResultSets and
>>>>>get data from all of them at the same time?
>>>>
>>>>I don't think so. The Javadoc for Statement says:
>>>>
>>>>"By default, only one ResultSet object per Statement object can be open at
>>>>the same time"
>>>>
>>>>To me, this suggests that some db's may allow multiple ResultSets per
>>>>Statement but that such extensions would be non-portable. Looking at the
>>>>source for AbstactJdbc1Statement, it has
>>>>
>>>>protected java.sql.ResultSet result = null;
>>>>
>>>>So it looks like PG has the one ResultSet to one Statement implementation.
>>>>
>>>>HTH
>>>>
>>>>--
>>>>Paul Thomas
>>>>+------------------------------+---------------------------------------------+
>>>>| Thomas Micro Systems Limited | Software Solutions for the Smaller
>>>>Business |
>>>>| Computer Consultants |
>>>>http://www.thomas-micro-systems-ltd.co.uk |
>>>>+------------------------------+---------------------------------------------+
>>>>
>>>>---------------------------(end of broadcast)---------------------------
>>>>TIP 3: if posting/reading through Usenet, please send an appropriate
>>>> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>>>> message can get through to the mailing list cleanly
>>>
>>>
>>>
>>
>
>
>
> /~\ The ASCII Felipe Schnack (felipes(at)ritterdosreis(dot)br)
> \ / Ribbon Campaign Analista de Sistemas
> X Against HTML Cel.: 51-91287530
> / \ Email! Linux Counter #281893
>
> Centro Universitário Ritter dos Reis
> http://www.ritterdosreis.br
> ritter(at)ritterdosreis(dot)br
> Fone: 51-32303341
>