Bug in getClob() in 7.2 jdbc2 driver? - Mailing list pgsql-jdbc

From Grant Goodale
Subject Bug in getClob() in 7.2 jdbc2 driver?
Date
Msg-id C2628B4FD1FD6B4EB3F2479F9124A1293FBEDC@MAILSERVER.reactivity.com
Whole thread Raw
List 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@reactivity.com

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: build.xml patch
Next
From: "Adebayo A. Alabi"
Date:
Subject: questions