How to set language on DB2 on AIX

How to set language on DB2 on AIX

am 02.09.2005 15:30:07 von h-taguchi

Hello,

I'm now using Perl 5.005, DBI-1.15, DBD-DB2-0.75 on AIX 4.3.
And like to upgrade them to Perl 5.8, DBI-1.48, DBD-DB2-0.78.

Installation may be ok, but when I INSERT double bytes characters,
I get the following error.
[IBM][CLI Driver] CLI0109E String data right truncation.

I'm using Japanese, and 80 byes wide char strings cann't be inserted
into varchar(80), current version is ok.
And smaller inserted strings seem to be unicode or utf-8.

Env vars related is LANG=Ja_JP only.
I tried NLS_LANG=American_America.JA16SJIS, which ended failed.

What is the right way to set correct language specification?
NLS_LANG is the correct thing to cope with?
I search dbi ML archives & goole but failed to find a good answer.

Regards,
Hirosi Taguti
h-taguchi@secom.co.jp

Re: How to set language on DB2 on AIX

am 23.09.2005 22:08:25 von dan.scott

h-taguchi@secom.co.jp wrote:
> Hello,
>
> I'm now using Perl 5.005, DBI-1.15, DBD-DB2-0.75 on AIX 4.3.
> And like to upgrade them to Perl 5.8, DBI-1.48, DBD-DB2-0.78.
>
> Installation may be ok, but when I INSERT double bytes characters,
> I get the following error.
> [IBM][CLI Driver] CLI0109E String data right truncation.
>
> I'm using Japanese, and 80 byes wide char strings cann't be inserted
> into varchar(80), current version is ok.
> And smaller inserted strings seem to be unicode or utf-8.
>
> Env vars related is LANG=Ja_JP only.
> I tried NLS_LANG=American_America.JA16SJIS, which ended failed.
>
> What is the right way to set correct language specification?
> NLS_LANG is the correct thing to cope with?
> I search dbi ML archives & goole but failed to find a good answer.
>
> Regards,
> Hirosi Taguti
> h-taguchi@secom.co.jp
>

Hello:

I asked one of the developers here to help me with an answer, and this
is what they responded with:


*****
varchar(80) means that it can hold up to 80 bytes of data (not 80
characters).

How many actual characters are there in your 80 byte Japanese string
and what are they?
What is the target database codepage ?
How are you inserting the data ?
Without this information, it is hard to answer your question .

However here are some examples/hints:
If database is Unicode (UTF-8), then data will be stored in UTF-8/1208
in varchar column.
If environment is set to Ja_JP(943 most likely) then data will be
converted from 943 to 1208.
During conversion 80 bytes of 943 could expand to more then 80 bytes in
1208 -> data will not fit into varchar(80) column.

It is also necessary to know what has changed in your environment.
If before you had English database or Japanese database, then data will
not expand and will fit.
You will need to drop/recreate your database to change it's codepage.
Another possibility is that you have UTF-8 data, not Japanese data,
then the problem is with settings on your client -
proper LANG or db2set db2codepage=1208 could be missing.

It is hard to advise until we know what data you are inserting into the
database, how are you doing it and database codepage you need . You
need to be very clear on what codepage the data is in and how you plan
to store it.

****

I hope this helps...

Dan