Re: UTF characters Java JDBC

From: Laurenz Albe <>
Date: Fri, 20 Nov 2009 08:30:57 +0100
Message-ID: <>

Barney wrote:
> I have a Java app that connects to an Oracle DB and I'm having
> problems when saving data that include some characters that are only
> available in UTF-8.
> The characters in question : ? T O o f
> I tried to add the following argument to the JVM but it did not
> worked : -Dclient.encoding.override=UTF-8
> Question #1 : Is there something I can do on the Java app side ?
> Question #2 : Is there something I can do on the Oracle DB side ?
> Below the result of the query SELECT * FROM NLS_DATABASE_PARAMETERS on
> the database, along with the Java code that interacts whit it.


The database character set is Latin-1, so you won't be able to store the characters in a CHAR, VARCHAR2 or CLOB column. No matter what you try.

So the answer the Question #1 is "no".

On the database side you have two options: 1) Migrate the database to the AL32UTF8 character set.

   This is the better, but more difficult option.    If you can start from scratch, I would definitely recommend that.    Make sure that you define text fields with [VAR]CHAR2(n CHAR) and    not [VAR]CHAR2(n).
2) Use NCHAR, NVARCHAR2 or NCLOB for text fields in which you

   want to store the non-ASCII characters.

Laurenz Albe Received on Fri Nov 20 2009 - 01:30:57 CST

Original text of this message