Re: Bug in getClob() in 7.2 jdbc2 driver?
От | Barry Lind |
---|---|
Тема | Re: Bug in getClob() in 7.2 jdbc2 driver? |
Дата | |
Msg-id | 3DB75730.9080507@xythos.com обсуждение исходный текст |
Ответ на | Bug in getClob() in 7.2 jdbc2 driver? ("Grant Goodale" <grant@reactivity.com>) |
Список | 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@reactivity.com > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html >
В списке pgsql-jdbc по дате отправления: