Solved the "character_set_results" problem when connecting to the mysql4.0 database.

Source: Internet
Author: User

I deployed my mas interface yesterday.ProgramThe above title is incorrect.

Client IP Address: 192.168.1.100. The mas interface program is deployed on the client.

Server IP: 192.168.1.101, mysql4.0 database.

Program connection to MySQL: ODBC, Driver: MySQL ODBC driver5.1 (this is the driver used before connection failure)

The connection string is as follows (C #):

Connectionstring = "driver = {MySQL ODBC 5.1 Driver}; server = 192.168.1.101; Port = 3306; option = 131072; stmt =; database = MAS; user = root; Password = 123456 ". when this connection string is used to connect data, an exception is returned: unknow system varibles "character_set_results "...... I guess it's about character sets. I checked the MySQL Character Set documentation. Let's just briefly describe it ,.

 

1. character_set_database: ensure that the data stored in the database is consistent with the database encoding;

2. Ensure that the character sets for communication are consistent with those for databases, that is, character_set_client and character_set_connection are consistent with character_set_database;

3. Ensure that the returned results of select are encoded in the same way as those of the program, that is, character_set_results is encoded in the same way as the program;

4. Ensure that the program encoding is consistent with the browser encoding, that is, the program encoding is consistent with <meta http-equiv = "Content-Type" content = "text/html; charset =? "/> Consistent.

I changed the connection string and set character_set_results = uft8. This is really an annoying problem.

Fortunately, I calmly analyzed whether the driver version was a problem. My MySQL driver version is 5.1, and MySQL version is 4.0.

Download the driver from the official website, change the driver of driver3.51, and connect again!

Connectionstring = "driver = {MySQL ODBC 3.51 driver}; server = 192.168.1.101; Port = 3306; option = 131072; stmt =; database = MAS; user = root; Password = 123456"

You can't hide the joy of your heart! Hope to help you with the same 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.