pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
"org.postgresql.util.PSQLException: This ResultSet is closed" in call to rst.getString(..)
4+ messages / 3 participants
[nested] [flat]

* "org.postgresql.util.PSQLException: This ResultSet is closed" in call to rst.getString(..)
@ 2005-10-05 22:18  Russ Tennant <russ@i2rd.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Russ Tennant @ 2005-10-05 22:18 UTC (permalink / raw)
  To: pgsql-jdbc


The following code throws an Exception with the postgresql jdbc driver. This code does work with the MySQL and HSQL JDBC drivers and it looks correct to me. The call to getString(..) is what is causing the exception. It appears the result set is considered closed even though ResultSet.next() returns true in this case. Any help would be appreciated. Thanks.

Info:
Server Version = 8.0.3
JDBC Driver Version = 8.0 Build 312

Code that causes exception:

ResultSet rstVersionColumns=meta.getVersionColumns(null, null, tableName);
while (rstVersionColumns.next())
{
    String fieldName=rstColumn.getString("COLUMN_NAME"); // Exception thrown here
    if (_logger.isDebugEnabled())
        _logger.debug("Version field "+fieldName);
    // [snip]
}


Partial Stack Trace

Caused by: org.postgresql.util.PSQLException: This ResultSet is closed.
	at org.postgresql.jdbc2.AbstractJdbc2ResultSet.checkClosed(AbstractJdbc2ResultSet.java:2457)
	at org.postgresql.jdbc2.AbstractJdbc2ResultSet.findColumn(AbstractJdbc2ResultSet.java:2358)
	at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:2203)

-- 
Russ Tennant
russ@i2rd.com

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: "org.postgresql.util.PSQLException: This ResultSet is
@ 2005-10-05 22:38  Oliver Jowett <oliver@opencloud.com>
  parent: Russ Tennant <russ@i2rd.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Oliver Jowett @ 2005-10-05 22:38 UTC (permalink / raw)
  To: Russ Tennant <russ@i2rd.com>; +Cc: pgsql-jdbc

Russ Tennant wrote:
> It appears the result set is considered closed even though
> ResultSet.next() returns true in this case.

Uh, you are calling getString on a different ResultSet to the one you
called next() on:

> ResultSet rstVersionColumns=meta.getVersionColumns(null, null, tableName);
> 
> while (rstVersionColumns.next())
> 
> {
> 
> String fieldName=rstColumn.getString("COLUMN_NAME"); // Exception thrown
> here

-O



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: "org.postgresql.util.PSQLException: This ResultSet is closed" in call to rst.getString(..)
@ 2005-10-05 23:17  Russ Tennant <russ@i2rd.com>
  parent: Oliver Jowett <oliver@opencloud.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Russ Tennant @ 2005-10-05 23:17 UTC (permalink / raw)
  To: pgsql-jdbc

On Wednesday 05 October 2005 5:38 pm, you wrote:
> Russ Tennant wrote:
> > It appears the result set is considered closed even though
> > ResultSet.next() returns true in this case.
>
> Uh, you are calling getString on a different ResultSet to the one you
>
> called next() on:
> > ResultSet rstVersionColumns=meta.getVersionColumns(null, null,
> > tableName);
> >
> > while (rstVersionColumns.next())
> >
> > {
> >
> > String fieldName=rstColumn.getString("COLUMN_NAME"); // Exception
> > thrown here
>
> -O

Ahah! :) Sorry for the false alarm.

-- 
Russ Tennant
russ@i2rd.com

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: "org.postgresql.util.PSQLException: This ResultSet is
@ 2005-10-05 23:20  Dave Cramer <pg@fastcrypt.com>
  parent: Oliver Jowett <oliver@opencloud.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Dave Cramer @ 2005-10-05 23:20 UTC (permalink / raw)
  To: Oliver Jowett <oliver@opencloud.com>; +Cc: Russ Tennant <russ@i2rd.com>; pgsql-jdbc

The more interesting thing is what do HSQL and MySql return here ;)

Dave
On 5-Oct-05, at 6:38 PM, Oliver Jowett wrote:

> Russ Tennant wrote:
>
>> It appears the result set is considered closed even though
>> ResultSet.next() returns true in this case.
>>
>
> Uh, you are calling getString on a different ResultSet to the one you
> called next() on:
>
>
>> ResultSet rstVersionColumns=meta.getVersionColumns(null, null,  
>> tableName);
>>
>> while (rstVersionColumns.next())
>>
>> {
>>
>> String fieldName=rstColumn.getString("COLUMN_NAME"); // Exception  
>> thrown
>> here
>>
>
> -O
>
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
>




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2005-10-05 23:20 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-05 22:18 "org.postgresql.util.PSQLException: This ResultSet is closed" in call to rst.getString(..) Russ Tennant <russ@i2rd.com>
2005-10-05 22:38 ` Re: "org.postgresql.util.PSQLException: This ResultSet is Oliver Jowett <oliver@opencloud.com>
2005-10-05 23:17   ` Russ Tennant <russ@i2rd.com>
2005-10-05 23:20   ` Re: "org.postgresql.util.PSQLException: This ResultSet is Dave Cramer <pg@fastcrypt.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox