How to Set garbled characters in the DB2 code page

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.