Oracle Database query is not garbled, and data garbled characters are displayed on the web end, oracleweb

Source: Internet
Author: User

Oracle Database query is not garbled, and data garbled characters are displayed on the web end, oracleweb

Recently, we migrated a project from our company, oracle deployed on one linux server, and web project deployed on another linux server. However, after the project deployment is complete, the returned data is garbled. The local database connection query shows no garbled characters, but the web query shows garbled characters, the problem basically occurs on the web end. It should be a character set problem.

1. First view the oracle database character set select * from nls_database_parameters; display the ZHS16GBK encoding format used by oracle.

2. Check whether the encoding format of the tomcat server is GBK. Then there is no problem with database query and server encoding, so the problem is only caused by the linux environment encoding problem. Linux has two configuration encoding parameters: LANG and NLS_LANG.LANG is used to set the language, region, and Character Set of the Linux system. It is valid for linux applications, such as date. NLS_LANG is used to set the Oracle language, region, and character set, valid for oracle tools.

Shut down the tomcat server, and execute the following statement before starting

Export LANG = zh_CN.GB2312

After the execution, restart tomcat to solve the problem.

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.