0

We are currently migrating data from DB2 10.1 AIX to DB2 11.1 Linux. Since we are using some features like versioning/history tables and rowchangetimestamps, db2move is not an option for some tables. As a result we do manual export and load for some tables.

The problem arrises for data having special character such as "Ñ".

Sample Data

PIÑATA

The AIX DB2 10.1 Counts the length for this as 6 characters and it fits fine to VARCHAR(6) columns. But when I load this to DB2 Linux 11.1, this is counted as 7 characters, thus data is truncated.

I tried CASTING this as VARCHAR(6) but the data is still truncated. I hope someone can point me to a possible solution.

  • What are the code pages of both databases? Single byte for 10.1 and utf-8 for 11.1? – Mark Barinstein Mar 5 at 5:22
  • Hi the codepage for 10.1 is 1252 and codeset is IBM-1252 while 11.1 is code page is 1208 and Codeset is UTF-8 – Tiesto Mar 5 at 6:19
2

Every character needs 1 byte in a single-byte database, but it may need from 1 to 4 bytes in a UTF-8 database.
When you specify VARCHAR(N) for a column, N is defined in string units.
OCTETS means bytes, and CODEUNITS32 means characters.
In your case N probably is OCTETS, and since Ñ character requires 2 bytes (OCTETS), then whole string length in the UTF-8 database is 7.
Character strings

  • Is there a way that I can make the database behave similar to when it was in AIX? The problem is some data are being truncated because of this. – Tiesto Mar 5 at 8:15
  • Should i just move my aix 10.1 db to 11.1 before i migrate to linux or it does not matter? – Tiesto Mar 5 at 12:23
  • 2
    Use CREATE DATABASE MYDB ... USING CODESET 1252 TERRITORY XX. You can get your 10.1 database territory code with the following command: db2 get db cfg for my101db | grep -i terr. Supported territory codes and code pages – Mark Barinstein Mar 5 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.