Author |
Message
|
lcl3977 |
Posted: Sun Jul 09, 2006 11:19 pm Post subject: problem:insert nchar to oracle in esql |
|
|
Apprentice
Joined: 04 Jul 2006 Posts: 27
|
in AIX 5.3 english language .
Our Oracle NLS_CHARACTERSET is utf-8,
in .profile we set NLS_LANG=american_america.al32utf8, LANG=en_US
then I write Chinese in esql,and then insert it into oracle.
but I can't find the right Chinese in the table.it only display ".....".
can somebody help me again.
thank you. |
|
Back to top |
|
 |
jbanoop |
Posted: Mon Jul 10, 2006 1:22 am Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
|
Back to top |
|
 |
lcl3977 |
Posted: Mon Jul 10, 2006 1:42 am Post subject: |
|
|
Apprentice
Joined: 04 Jul 2006 Posts: 27
|
thank you for your help.
our db support Chinese.
the problem of "arabic data",is read data from DB,
we can read it from DB ,and then convert it ,we can get correct char.
but I can't insert Chinese into DB.when I insert some words ,and then I export it in sqlplus,that just display "....." |
|
Back to top |
|
 |
jbanoop |
Posted: Mon Jul 10, 2006 2:58 am Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
let me explain the problem we faced:
We receive input which may contain arabic (read chinese) characters.
We insert the same into a DB (oracle)
We read the inserted data in another flow and send it on its way.
The issue we faced was at the second step where we try inserting into oracle , when the insert itself was resulting in some characters not being inserted. (My suspect is the oracle driver used by broker to talk to the DB ).
I think you are also facing the same problem. Do confirm my understanding.
So the work around we used was that we converted the arabic (read chinese) data to blob and inserted in blob field in DB. this prevents data loss during the insert.
In the code that is required to read it back from the DB, read it as blob and cast it to character. It will work fine.
Do let me know how you went with this (in case you try it)
Regards,
Anoop |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jul 10, 2006 2:25 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Make sure you have set LANG, NLS_LANG, or other system specific environment variable in broker profile to proper language values for your system before trying to insert regional language characters into Oracle database. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
lcl3977 |
Posted: Mon Jul 10, 2006 5:19 pm Post subject: |
|
|
Apprentice
Joined: 04 Jul 2006 Posts: 27
|
thank you Anoop & jefflowrey.
Our environment is on AIX 5.3.
I test it in WINXP simple Chinese.
when I set DB charset GBK(that supports chinese),and then insert Chinese into DB in the esql, then I select it in sqlplus ,we can see the correct char.
But,when I test it in AIX,(the environment of AIX I has told),I can't see the correct char..
I think may be our environment variable has something wrong.I have changed them (e.g. NLS_LANG,LANG,LC_ALL).I don't know what I must set them. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jul 11, 2006 2:38 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The broker profile should have the AIX correct language environment variable - and I don't remember which is the AIX version - set to the most commonly used language you work with. So if most of your message data is Chinese, then set it to the chinese value. If most of it is English, then it would be "en_<cc>", where <cc> might be UK or US or etc.
But mostly the important thing is that it is actually set to *something*. Otherwise, national language characters tend to get mangled because they are translated improperly into the character set the DB is using.
And it's got to be in the broker profile - and you may need to restart the broker to ensure that it's set in the current execution. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
lcl3977 |
Posted: Tue Jul 11, 2006 4:43 pm Post subject: |
|
|
Apprentice
Joined: 04 Jul 2006 Posts: 27
|
thank you jefflowrey.
I had set LANG=zh_CN or LANG=zh_CN.UTF-8
and then I write Chinese in esql,insert into DB,It just display the same char(some incorrect words) in despite of what Chinese I write in esql. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jul 11, 2006 8:42 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
lcl3977 wrote: |
thank you jefflowrey.
I had set LANG=zh_CN or LANG=zh_CN.UTF-8
and then I write Chinese in esql,insert into DB,It just display the same char(some incorrect words) in despite of what Chinese I write in esql. |
Wouldn't chinese be a double byte character language and as such require either unicode or at least UTF-16 ??
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
lcl3977 |
Posted: Wed Jul 12, 2006 5:32 pm Post subject: |
|
|
Apprentice
Joined: 04 Jul 2006 Posts: 27
|
fjb_saper wrote: |
lcl3977 wrote: |
thank you jefflowrey.
I had set LANG=zh_CN or LANG=zh_CN.UTF-8
and then I write Chinese in esql,insert into DB,It just display the same char(some incorrect words) in despite of what Chinese I write in esql. |
Wouldn't chinese be a double byte character language and as such require either unicode or at least UTF-16 ??
Enjoy  |
Chinese is a double byte character language, and utf-8 can supports it. |
|
Back to top |
|
 |
lcl3977 |
Posted: Wed Jul 12, 2006 5:45 pm Post subject: |
|
|
Apprentice
Joined: 04 Jul 2006 Posts: 27
|
when the broker is running on the winxp,and then insert chinese into remote database(on aix),we can also find the right char. |
|
Back to top |
|
 |
lcl3977 |
Posted: Thu Jul 13, 2006 1:12 am Post subject: |
|
|
Apprentice
Joined: 04 Jul 2006 Posts: 27
|
successfully...
oh..yea....
when I set
Code: |
export LANG=ZH_CN
export MQCCSID=1208
|
and then I insert chinese into db in esql. we find the right char displaying.
thank you for your help.
jbanoop
if you set the values the same sa me ,I think you won't convert them to blob. |
|
Back to top |
|
 |
lcl3977 |
Posted: Thu Jul 13, 2006 1:15 am Post subject: |
|
|
Apprentice
Joined: 04 Jul 2006 Posts: 27
|
You can use the executable locale to show your current locale. The command locale -a displays all the locales currently installed on the machine. Make sure that the locale you select for LANG and LC_ALL is in the list that locale -a returns. The values that locale uses and returns are case-sensitive, so copy them exactly when assigning them to an environment variable.
When you start a broker component, the locale of that component is inherited from the shell in which it is started. The broker component uses the LC_MESSAGES environment variable as the search path in the NLSPATH environment variable (LC_MESSAGES is set when variable LC_ALL is exported).
Messages are sent to the syslog in the code page set by this locale. If you have multiple brokers that write to this syslog, their messages are in the code page of the locale in which they were started, for example:
Code: |
locale syslog code page ccsid
pt_BR iso8859-1 819
Pt_BR ibm-850 850
PT_BR utf-8 1208
|
|
|
Back to top |
|
 |
|