Thread: multiple resource sets

multiple resource sets

From
Rolf Schillinger
Date:
Hi,
I`m having huge troubles using postgresql JDBC.
I do the following:
while (orderlines.next())
                        {
PreparedStatement as_st=db.prepareStatement("SELECT nr,beschreibung,
    beschreibung_2,preis FROM artikel where nr=?");
System.out.println(orderlines.getRow()+" : "+orderlines.getString(2));
}
As result I get:
1 : KKSC025
2 : KKTO045
which is totally okay cause the underlying table data is as follows:
     id     |   nr    | anzahl | eht
------------+---------+--------+-----
 1226969416 | KKSC025 |     22 | BU1
 1226969416 | KKTO045 |     22 | KT

So far so good.
I know want to process the results of that orderlines query by adding:
as_st.setString(1,orderlines.getString(2));
as=as_st.executeQuery();
as.close();
to the above while loop.
Output now looks like:
1 : KKSC025
2 : Nalo schmal 45/50 rauchbraun
1) is still correct while 2) has the value of as_st/as now.
I`m getting desperate on that.
any help would be greatly appreciated.
thanks, Rolf




Re: multiple resource sets

From
"Dave Cramer"
Date:
Rolf,


Try this

ResultSet orderlines = _st.executeQuery();

while(orderlines.next()){
     println(orderlines.get(1));
}
orderlines.close();
_st.close();

Dave
----- Original Message -----
From: "Rolf Schillinger" <rolf@sir-wum.de>
To: <pgsql-jdbc@postgresql.org>
Sent: Wednesday, May 02, 2001 10:12 AM
Subject: [JDBC] multiple resource sets


> Hi,
> I`m having huge troubles using postgresql JDBC.
> I do the following:
> while (orderlines.next())
>                         {
> PreparedStatement as_st=db.prepareStatement("SELECT nr,beschreibung,
> beschreibung_2,preis FROM artikel where nr=?");
> System.out.println(orderlines.getRow()+" : "+orderlines.getString(2));
> }
> As result I get:
> 1 : KKSC025
> 2 : KKTO045
> which is totally okay cause the underlying table data is as follows:
>      id     |   nr    | anzahl | eht
> ------------+---------+--------+-----
>  1226969416 | KKSC025 |     22 | BU1
>  1226969416 | KKTO045 |     22 | KT
>
> So far so good.
> I know want to process the results of that orderlines query by adding:
> as_st.setString(1,orderlines.getString(2));
> as=as_st.executeQuery();
> as.close();
> to the above while loop.
> Output now looks like:
> 1 : KKSC025
> 2 : Nalo schmal 45/50 rauchbraun
> 1) is still correct while 2) has the value of as_st/as now.
> I`m getting desperate on that.
> any help would be greatly appreciated.
> thanks, Rolf
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>


Re: multiple resource sets

From
Rolf Schillinger
Date:
Hi Dave,
Thanks for helping me but this post was kinda runaway. I thought it didn`t
get through at first, forgot about it and tried upgrading the JDBC driver.
After doing this now all of that stuff works. So it was an error in the
JDBC driver :)
bis bald, Rolf

On Thu, 3 May 2001, Dave Cramer wrote:

> Rolf,
>
>
> Try this
>
> ResultSet orderlines = _st.executeQuery();
>
> while(orderlines.next()){
>      println(orderlines.get(1));
> }
> orderlines.close();
> _st.close();
>
> Dave
> ----- Original Message -----
> From: "Rolf Schillinger" <rolf@sir-wum.de>
> To: <pgsql-jdbc@postgresql.org>
> Sent: Wednesday, May 02, 2001 10:12 AM
> Subject: [JDBC] multiple resource sets
>
>
> > Hi,
> > I`m having huge troubles using postgresql JDBC.
> > I do the following:
> > while (orderlines.next())
> >                         {
> > PreparedStatement as_st=db.prepareStatement("SELECT nr,beschreibung,
> > beschreibung_2,preis FROM artikel where nr=?");
> > System.out.println(orderlines.getRow()+" : "+orderlines.getString(2));
> > }
> > As result I get:
> > 1 : KKSC025
> > 2 : KKTO045
> > which is totally okay cause the underlying table data is as follows:
> >      id     |   nr    | anzahl | eht
> > ------------+---------+--------+-----
> >  1226969416 | KKSC025 |     22 | BU1
> >  1226969416 | KKTO045 |     22 | KT
> >
> > So far so good.
> > I know want to process the results of that orderlines query by adding:
> > as_st.setString(1,orderlines.getString(2));
> > as=as_st.executeQuery();
> > as.close();
> > to the above while loop.
> > Output now looks like:
> > 1 : KKSC025
> > 2 : Nalo schmal 45/50 rauchbraun
> > 1) is still correct while 2) has the value of as_st/as now.
> > I`m getting desperate on that.
> > any help would be greatly appreciated.
> > thanks, Rolf
> >
> >
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> >
> >
>
>