Unix Technical Forum

"org.postgresql.util.PSQLException: This ResultSet is closed" in call to rst.getString(..)

This is a discussion on "org.postgresql.util.PSQLException: This ResultSet is closed" in call to rst.getString(..) within the pgsql Interfaces jdbc forums, part of the PostgreSQL category; --> The following code throws an Exception with the postgresql jdbc driver. This code does work with the MySQL and ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces jdbc

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-15-2008, 11:40 PM
Russ Tennant
 
Posts: n/a
Default "org.postgresql.util.PSQLException: This ResultSet is closed" in call to rst.getString(..)


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() returnstrue 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.checkC losed(AbstractJdbc2ResultSet.java:2457)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.findCo lumn(AbstractJdbc2ResultSet.java:2358)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getStr ing(AbstractJdbc2ResultSet.java:2203)

--
Russ Tennant
russ@i2rd.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD4DBQBDRFEsF1PNCHnhVNURAnofAJUdvS2B1yn2ZBan4gHBp0 sCZwXRAJ0SDTOM
nrxEPuREsNlwNIYpH/msgg==
=eW8p
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-15-2008, 11:40 PM
Oliver Jowett
 
Posts: n/a
Default Re: "org.postgresql.util.PSQLException: This ResultSet is

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-15-2008, 11:40 PM
Russ Tennant
 
Posts: n/a
Default Re: "org.postgresql.util.PSQLException: This ResultSet is closed" in call to rst.getString(..)

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBDRF8eF1PNCHnhVNURApQmAJ97aNL+6Uhc1OEe6qQhkj yOIxGYFgCfWKuM
lwlx/B5WpL/z4hXAFhESWEM=
=Rzjf
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-15-2008, 11:40 PM
Dave Cramer
 
Posts: n/a
Default Re: "org.postgresql.util.PSQLException: This ResultSet is

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
>
>



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:32 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com