7

I have got a problem with saving Persian characters like ("ی" or "ک") into oracle database. I receive correct encoding from a client, but when I insert the related record into the database, it will be saved with Arabic encoding like this ("ي").

The specifications of my application are:

  • WebLogic application server 12c on Linux
  • Oracle 11 g (thin driver)
  • OpenJPA 2.2.2

I set the following properties into WebLogic setting file, but it did not work.

export NLS_LANG=AMERICAN_AMERICA.AR8MSWIN1256
export NLS_LANG=AMERICAN_AMERICA.UTF8
-Dfile.encoding=UTF-8
Elyas Hadizadeh
  • 3,289
  • 8
  • 40
  • 54
mahnaz ebrahimi
  • 111
  • 1
  • 10
  • IIRC Oracle also has a locale that must be set on the server side. – BadZen Apr 14 '15 at 05:14
  • I think it is an issue with the **client** characterset. Check the database characterset and set the client characterset as the same. Post the results of `select value from v$nls_parameters where parameter = 'NLS_CHARACTERSET';` **-- locale-specific characterset** `select value from nls_database_parameters where parameter = 'NLS_CHARACTERSET';` **-- database characterset** See http://lalitkumarb.wordpress.com/2014/09/24/why-are-junk-values-displayed-in-my-client/ – Lalit Kumar B Apr 14 '15 at 05:14
  • Do you have **both** exports of `NLS_LANG`? There should be only one. – Wernfried Domscheit Apr 14 '15 at 07:28
  • Encoding of client is correct, it has problem with weblogic. result of two query is: AR8MSWIN1256. I set one of the NLS_LANG exports each time. – mahnaz ebrahimi Apr 14 '15 at 13:04

1 Answers1

3

By adding following properties into weblogic setting ('JAVA_OPTIONS' part of setDomainEnv.sh file), my problem has been resolved by help of this link

-Doracle.jdbc.defaultNChar=true 
-Doracle.jdbc.convertNcharLiterals=true
Community
  • 1
  • 1
mahnaz ebrahimi
  • 111
  • 1
  • 10