Re: error getString() --> decodeUTF8 /

From: Daniel Serodio <daniel(at)checkforte(dot)com(dot)br>
To: Pedro Salazar <pedro-b-salazar(at)ptinovacao(dot)pt>
Cc: PostgreSQL JDBC List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: error getString() --> decodeUTF8 /
Date: 2003-04-14 12:40:50
Message-ID: 1050324050.2277.0.camel@kelly.ckf
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

AFAIK, the problem is the encoding, not the locale. Did you try initdb
-E latin1 ???

[]'s
Daniel Serodio

On Mon, 2003-04-14 at 07:09, Pedro Salazar wrote:
> Barry,
>
> Besides the improved message issue, I tried with a database with the
> default locale (C), but I also tried to restore the database to the
> cluster with portuguese locale (pt_PT) (initdb --locale=pt_PT
> --lc-colate=pt_PT --lc-ctype=pt_PT --lc-message=pt_PT), and I still have
> the same error in JDBC (not the improved message, but the error).
>
> What configurations should I have to support portuguese locale in my
> database/JDBC?
>
> thanks,
> Pedro Salazar.
>
> On Fri, 2003-04-11 at 16:46, Barry Lind wrote:
> > Pedro,
> >
> > If you were running the latest build from http://jdbc.postgresql.org you
> > would see the following improved 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
> >
> >
> > Pedro Salazar wrote:
> > > Hi,
> > >
> > > I forgot to tell that I'm using the JDBC driver build from postgresql
> > > 7.3.2.
> > >
> > > PS
> > >
> > > On Fri, 2003-04-11 at 11:19, Pedro Salazar wrote:
> > >
> > >>Greetings,
> > >>
> > >>I have function that returns a refcursor. When I call it in plpgsql
> > >>shell, it returns all the rows correctly. But, When I call it in JDBC,
> > >>when it tries to decode a string in specific row (7) it throws the
> > >>following exception:
> > >>
> > >>java.lang.ArrayIndexOutOfBoundsException: 5
> > >> at org.postgresql.core.Encoding.decodeUTF8(Encoding.java:254)
> > >> at org.postgresql.core.Encoding.decode(Encoding.java:165)
> > >> at org.postgresql.core.Encoding.decode(Encoding.java:181)
> > >> at
> > >>org.postgresql.jdbc1.AbstractJdbc1ResultSet.getString(AbstractJdbc1ResultSet.java:97)
> > >>
> > >>My refcursor returns the following list (the characters are in
> > >>portuguese language):
> > >>
> > >> id | class
> > >>----+-------------
> > >> 1 | Avenida
> > >> 2 | Bairro
> > >> 3 | Cais
> > >> 4 | Estrada
> > >> 5 | Largo
> > >> 6 | Lugar
> > >> 7 | Praça
> > >> 8 | Rotunda
> > >> 9 | Rua
> > >> 10 | Sítio
> > >> 11 | Travessa
> > >> 12 | Urbanização
> > >>
> > >>The row number 7 (Praça) [character 'C' with cedilla] is throwing the
> > >>above exception. How should I retrieve my string which has portuguese
> > >>characters, in JDBC?
> > >>
> > >>thanks,
> > >>Pedro Salazar.
--
Daniel Serodio
CheckForte 5582-6016

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2003-04-14 12:45:34 Re: setCatalog
Previous Message Patrik Lundgren 2003-04-14 12:04:03 Re: setCatalog