Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: What causes this exception "Char array not long enough: javaCharsToUtf8Bytes" ?

Re: What causes this exception "Char array not long enough: javaCharsToUtf8Bytes" ?

From: RHC <rclarence_at_juno.com>
Date: Fri, 02 Feb 2001 00:30:06 -0000
Message-ID: <t7jvsec20fmid9@corp.supernews.com>

Without seeing your code, I'd say the problem is you are trying to read too many characters from the database into a character array that is too small. Try using the String datatype instead and then convert to characters via the toCharArray method.

i.e String x = rs.getString(1) // or a column name

    char [] chars = x.toCharArray();

If you want to write binary data to the database I suggest using either BLOBs (Binary Large Objects) or Long RAW columns. Longs are essentially for character data.

HTH
RHC Randy wrote:
>
>
> Using JDBC to write data to Oracle 8.1.6 on a Sun Solaris box, I'm
 getting
> an I/O exception with message:
>
> "Char array not long enough: javaCharsToUtf8Bytes : javaCharsToUtf8Bytes
 ()"
>
> Also, binary data being written to a LONG column appears to be getting
> corrupted.
>
> Does anyone know what causes this and have a solution?
>
> -Randy.
>
>

--
Posted via CNET Help.com
http://www.help.com/
Received on Thu Feb 01 2001 - 18:30:06 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US