Re: JDBC2 driver failure

From: Haig Ehramdjian <haige(at)cae(dot)com>
To: "'Barry Lind'" <blind(at)xythos(dot)com>
Cc: "Mailing List: PGSQL (E-mail)" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC2 driver failure
Date: 2003-03-27 15:10:08
Message-ID: 69F1436AA435D7118EE1009027B0FF3A01216245@caemsx02.cae.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Thanks Barry, I implemented a 2nd Statement and it works like a charm.

Haig Ehramdjian

-----Original Message-----
From: Barry Lind [mailto:blind(at)xythos(dot)com]
Sent: Thursday, March 27, 2003 12:00 AM
To: Haig Ehramdjian
Cc: Mailing List: PGSQL (E-mail)
Subject: Re: [JDBC] JDBC2 driver failure

Haig,

You need to use a different Statement object for the second query.
According to the jdbc spec you can have only one result set open at a
time for a given statement. So when in the code you create rs2 from
stmt you are causing rs to automatically be closed. Then when the next
iteration of the look is executed rs.next() will fail.

--Barry

Haig Ehramdjian wrote:
> Hello,
>
> I have some code that does the following:
>
> ResultSet rs = stmt.executeQuery("myQuery");
>
> while (rs.next()) {
> //some processing
> String query = "blahblah";
> ResultSet rs2 = stmt.executeQuery(query);
> }
>
> All the processing up to rs2 works fine, but the instant I try to get the
> result set,
> I get the following errors in my catalina.out log file on Tomcat4:
>
> java.lang.NullPointerException
> at org.postgresql.jdbc2.ResultSet.next(ResultSet.java:113)
> at
> org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java)
>
> Any ideas? This is part of an in-house app I'm building and seems to be
the
> last stumbling block.
>
> Thanks a lot,
> Haig Ehramdjian
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

Browse pgsql-jdbc by date

  From Date Subject
Next Message John Laban 2003-03-27 21:40:20 JDBC with SSL
Previous Message Scot P. Floess 2003-03-27 12:09:12 Re: Help Needed with Connection Pooling for Java Swing Based