Thread: exception in decodeUTF8

exception in decodeUTF8

From
"Mykola Dudar"
Date:
Please reply to email dmykola@hpcerc.unm.edu
 
Hey,
We are using PostgreSQL 7.3 JDBC driver, JDK 1.1. Everything works fine execmpt one ow. Actually one cell in a row.
Table defined as
CREATE TABLE IAProtocolSpotAttrName
(
  IAProtocolName        VARCHAR(64) NOT NULL,
  DBAttrName            VARCHAR(64) NOT NULL,
  FileAttrNAme          VARCHAR(64) NOT NULL,
  DataType              VARCHAR(8) NOT NULL,
  OrderID               SMALLINT NOT NULL
);
 
One the row inserted as
INSERT INTO IAProtocolSpotAttrName
VALUES ('GenePixAll', 'Rgn_R2', 'Rgn R²', 'number', 33);
 
The cell with 'Rgn R²' is a problem. When I try to run getObject for that cell, have an error:
 
java.lang.ArrayIndexOutOfBoundsException: 6
     java.lang.String org.postgresql.core.Encoding.decodeUTF8(byte[], int,int)
    Encoding.java:259
     java.lang.String org.postgresql.core.Encoding.decode(byte[], int, int)
     Encoding.java:165
     java.lang.String org.postgresql.core.Encoding.decode(byte[])
     Encoding.java:181
     java.lang.String
org.postgresql.jdbc1.AbstractJdbc1ResultSet.getString(int)
     AbstractJdbc1ResultSet.java:97
     java.lang.Object
org.postgresql.jdbc1.AbstractJdbc1ResultSet.getObject(int)
     AbstractJdbc1ResultSet.java:488
 
Ideas?
Mykola

Re: exception in decodeUTF8

From
Barry Lind
Date:
Mykola,

If you use the latest build of the driver on the jdbc.postgresql.org
website you will get a better error message:

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.

thanks,
--Barry


Mykola Dudar wrote:
> Please reply to email dmykola@hpcerc.unm.edu <mailto:dmykola@hpcerc.unm.edu>
>
> Hey,
> We are using PostgreSQL 7.3 JDBC driver, JDK 1.1. Everything works fine
> execmpt one ow. Actually one cell in a row.
> Table defined as
> CREATE TABLE IAProtocolSpotAttrName
> (
>   IAProtocolName        VARCHAR(64) NOT NULL,
>   DBAttrName            VARCHAR(64) NOT NULL,
>   FileAttrNAme          VARCHAR(64) NOT NULL,
>   DataType              VARCHAR(8) NOT NULL,
>   OrderID               SMALLINT NOT NULL
> );
>
> One the row inserted as
> INSERT INTO IAProtocolSpotAttrName
> VALUES ('GenePixAll', 'Rgn_R2', 'Rgn R²', 'number', 33);
>
> The cell with 'Rgn R²' is a problem. When I try to run getObject for
> that cell, have an error:
>
> java.lang.ArrayIndexOutOfBoundsException: 6
>      java.lang.String org.postgresql.core.Encoding.decodeUTF8(byte[],
> int,int)
>     Encoding.java:259
>      java.lang.String org.postgresql.core.Encoding.decode(byte[], int, int)
>      Encoding.java:165
>      java.lang.String org.postgresql.core.Encoding.decode(byte[])
>      Encoding.java:181
>      java.lang.String
> org.postgresql.jdbc1.AbstractJdbc1ResultSet.getString(int)
>      AbstractJdbc1ResultSet.java:97
>      java.lang.Object
> org.postgresql.jdbc1.AbstractJdbc1ResultSet.getObject(int)
>      AbstractJdbc1ResultSet.java:488
>
> Ideas?
> Mykola