0
votes

I create my database with the following command:

db2 create database kixfs using codeset UTF-8 territory AT

My insert scripts (DMLs) are ecoded in UTF-8. enter image description here

Example insert statement from resources.dml:

INSERT INTO RESOURCES (RESOURCEKEY, LANGUAGE, CATEGORY, RESOURCEVALUE) VALUES ('XXXX', 'de', 'action', 'Funktion "Gerätemodell erfassen" erfolgreich ausgeführt.');

If i check the table content after creation:

Fehler bei der Ausführung der Funktion "Gerätemodell erfassen".

If i check the database configuration everything looks fine: (db2 get db cfg for MY_DB) enter image description here

Any ideas why the data is read or stored wrong?

Edit: I execute the insert script via a batchfile from the db2 admin console (CLP):

db2 -t -v -f resources.dml +o -z createTablesViews.log

Could it depend from the encoding of the db2 termminal?? And if yes how do i change it?

1
How do you check the table content? - Lennart
i view it in chrome with a special program developed in our company. it is been used for several years and has no problems with the encoding. When the dml files were encoded cp1252 the umlauts were stored and viewed correctly. After i changed the encoding of the dml insertscripts the umlauts were stored/read wrong by db2. - izocan
i check it with a custom sw of our company. it has been used for several years and has no problems with the encoding. it also displayed the umlauts correctly when the insertscripts .DML files were encoded cp1252 (windows format). After changing the encoding to utf8 and correcting the umlauts and special chars it is stored/read wrong. - izocan
Probably easiest to determine by debugging and check what is returned from db2 byte by byte. I would also get a second opinion from say squirrel or a python script (or whatever scripting language you use) - Lennart
what do you mean to check the db2 answer. It wont answer anything else then it is stored in the tables?? or did i get you wrong. I assume that either the db2 commands are reading the dmls in a wrong format before preparing to write. OR it reads it as UTF-8 and writes it with another encoding. The last option is that eiter reading or writing is in the wrong format! - izocan

1 Answers

0
votes

We had the same problem. Script, too. The script encoding has to match the server encoding, in our case ANSI. Even if the database is UTF-8. Converting the script file to ANSI did the trick for us.