From: | Barry Lind <blind(at)xythos(dot)com> |
---|---|
To: | Grant Goodale <grant(at)reactivity(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Bug in getClob() in 7.2 jdbc2 driver? |
Date: | 2002-10-24 02:13:04 |
Message-ID: | 3DB75730.9080507@xythos.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Grant,
If the column is type TEXT you should be using getString(). getClob()
if for types BYTEA and/or OID (aka Large Objects).
thanks,
--Barry
Grant Goodale wrote:
> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
From | Date | Subject | |
---|---|---|---|
Next Message | Raymund | 2002-10-24 08:20:37 | how to insert the letter "ñ" |
Previous Message | Stephen J. Thompson | 2002-10-24 00:41:01 | XA for postgres |