During the application of DB2, Chinese characters are often garbled due to the code page settings. The following describes how to set garbled characters in the DB2 code page for your reference.
To create a database, you can use the following statement to directly create a database with a Chinese code page:
Db2 create db db2name using codeset 1386 territyor 86
In the DB2 database, Character Set-related problems mainly involve three levels of Character Set settings. The system-level and instance-level character sets can be modified as needed, database-level datasets must be determined during database creation.
(1) Operating System Locale: system-level code page setting determines the default code page of the application;
If you want to set OS Locale to Chinese, consider the following method:
Unix: You can use the export LANG = "zh_CN" command to modify the current Locale to Chinese;
Windows: Choose "start"> "Settings"> "Control Panel"> "region options" to set the system language;
(2) DB2CODEPAGE: the code page setting at the DB2 instance level, which affects the DB2 application to determine the code page when converting the code page.
You can use the db2set DB2CODEPAEG = command to set DB2CODEPAGE to the character set you need.
(3) database codepage: Specifies the DB2 DATABASE-level code page. It must be set at the time of DATABASE creation.
When creating a database, you must specify the required code page:
Db2 "create database dbname using codeset UTF-8 territory cn"
Note: This statement can be used to create a Unicode database with the specified region as China (CN.
Implementation of DB2 string connection
Use of the DB2 auto-incrementing field IDENTITY
Introduction to DB2 datetime Data Types
Six common DB2 command lines
Four precautions for DB2 Data Import