You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Johan Oskarsson <jo...@oskarsson.nu> on 2006/02/02 14:02:25 UTC
Invalid character
I've managed to get a very strange character in one of my tables.
This means I cannot select from that table without ibatis
throwing this exception. The database is using unicode,
so this is just some non existing character that somehow got in there.
I'd like to just ignore this error and keep retrieving the other rows.
Is this possible:
The exception:
[02-02 12:55:27] main (LabelIndexer.java:136) - Could not add document
to index: 100965
org.postgresql.util.PSQLException: Invalid character data was found.
This is most likely caused by stored data containing characters that are
invalid for the character set the database was created in. The most
common example of this is storing 8bit data in a SQL_ASCII database.
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1891)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:2190)
at
fm.last.lucene.indexers.catsearch.LabelIndexer.index(LabelIndexer.java:132)
at
fm.last.lucene.indexers.CatSearchIndexer.index(CatSearchIndexer.java:51)
at
fm.last.lucene.indexers.CatSearchIndexer.main(CatSearchIndexer.java:73)
Caused by: java.io.IOException: UTF-8 string representation was truncated
at org.postgresql.core.Encoding.decodeUTF8(Encoding.java:304)
at org.postgresql.core.Encoding.decode(Encoding.java:179)
at org.postgresql.core.Encoding.decode(Encoding.java:193)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1887)
... 4 more
Re: Invalid character
Posted by Johan Oskarsson <jo...@last.fm>.
Larry Meadors wrote:
>This is an issue in the JDBC driver, not iBATIS.
>
>I'd suggest deleting the row with one of the native DB toosl that come
>with postresql, or setting the field's value to null or "".
>
>Larry
>
>
Yes, I realize that the exception/problem is caused by the jdbc driver,
however I'd like to
let the query finish somehow, like I could when I retrieved the rows
manually using jdbc by
catching the exceptions for the resultset.get and just moving on to the
next row if something went wrong.
I haven't found any way to do this using ibatis.
I could remove the problematic row in the db, but as new ones are added
by users the problem
could resurface.
/Johan
Re: Invalid character
Posted by Larry Meadors <lm...@apache.org>.
This is an issue in the JDBC driver, not iBATIS.
I'd suggest deleting the row with one of the native DB toosl that come
with postresql, or setting the field's value to null or "".
Larry
On 2/2/06, Johan Oskarsson <jo...@oskarsson.nu> wrote:
> I've managed to get a very strange character in one of my tables.
> This means I cannot select from that table without ibatis
> throwing this exception. The database is using unicode,
> so this is just some non existing character that somehow got in there.
>
> I'd like to just ignore this error and keep retrieving the other rows.
> Is this possible:
>
> The exception:
>
> [02-02 12:55:27] main (LabelIndexer.java:136) - Could not add document
> to index: 100965
> org.postgresql.util.PSQLException: Invalid character data was found.
> This is most likely caused by stored data containing characters that are
> invalid for the character set the database was created in. The most
> common example of this is storing 8bit data in a SQL_ASCII database.
> at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1891)
> at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:2190)
> at
> fm.last.lucene.indexers.catsearch.LabelIndexer.index(LabelIndexer.java:132)
> at
> fm.last.lucene.indexers.CatSearchIndexer.index(CatSearchIndexer.java:51)
> at
> fm.last.lucene.indexers.CatSearchIndexer.main(CatSearchIndexer.java:73)
> Caused by: java.io.IOException: UTF-8 string representation was truncated
> at org.postgresql.core.Encoding.decodeUTF8(Encoding.java:304)
> at org.postgresql.core.Encoding.decode(Encoding.java:179)
> at org.postgresql.core.Encoding.decode(Encoding.java:193)
> at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1887)
> ... 4 more
>
>
>