Bug in getClob() in 7.2 jdbc2 driver?

From: "Grant Goodale" <grant(at)reactivity(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Bug in getClob() in 7.2 jdbc2 driver?
Date: 2002-10-22 23:00:50
Message-ID: C2628B4FD1FD6B4EB3F2479F9124A1293FBEDC@MAILSERVER.reactivity.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

I'm trying to access a TEXT column (call it "foo") in a 7.1.3
table via getClob(). However, I'm receiving the following SQLException:

Bad Integer: <contents of "foo">
at org.postgresql.jdbc2.ResultSet.toInt(ResultSet.java:1481)
at org.postgresql.jdbc2.ResultSet.getInt(ResultSet.java:247)
at org.postgresql.jdbc2.ResultSet.getClob(ResultSet.java:980)
at org.postgresql.jdbc2.ResultSet.getClob(ResultSet.java:972)
... and off into my code.

In my code, I'm calling ResultSet.getClob(columnName) with a valid
column name, which winds up in getClob(int i):

public Clob getClob(int i) throws SQLException
{
return new org.postgresql.largeobject.PGclob(connection,
getInt(i));
}

After looking through the code, it would appear that the problem
lies in getClob()'s use of getInt():

public int getInt(int columnIndex) throws SQLException
{
return toInt( getFixedString(columnIndex) );
}

The comments above getFixedString() (which converts a string
containing monetary data into a proper integer) suggest that getInt()
should be called when working with a column's data, but the results of
getInt() are being passed to the constructor of PGclob!

Am I just misusing this function? Any help would be greatly
appreciated.

Regards,

Grant Goodale
grant(at)reactivity(dot)com

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jean-Christian Imbeault 2002-10-23 12:56:02 Re: Trouble connecting
Previous Message Kris Jurka 2002-10-22 21:56:53 Re: build.xml patch