Linux under Occi operation Oracle Database, Chinese garbled problem

Source: Internet
Author: User

Reprint: http://www.linuxidc.com/Linux/2008-02/11238.htm

The first few days after the OCI connected to the database problem, with the Oracle's own example test, can read the data (all in English), it is safe to go to develop other modules. These days to do the database module is the need to insert Chinese data, only to find that inserted into the "????". Make sure that the data is in GB2312 format and is still invalid after conversion to UTF-8. Turn over and over again, always not effective.

Google found an article on the client to set the CharSet Nls_lang, remember the previous installation of Oracle is an English installation, only set the LANG variable, this is not set. The Oracle server-side SELECT * from sys.props$

Nls_language=american
Nls_territory=america
Nls_iso_currency=america
Nls_characterset=zhs16gbk

Set the Nls_lang=american_america based on these parameters. ZHS16GBK (the Google out article is set to nls_lang= "simplified Chinese_china. ZHS16GBK ", because the character set settings for the installed server are different).

Then export Nls_lang=american_america in the/etc/profile. ZHS16GBK, then Source/etc/profile, and then run the program, Haha, Chinese came out Ah!

Linux under Occi operation Oracle Database, Chinese garbled problem

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.