Using the MySQL database, insert the data with a question mark (? ) Problem, workaround

Source: Internet
Author: User

First, the MySQL database I used was version 5.7.12.

Problems that arise:

1. Insert data display error, insert unsuccessful, appears: incorrect string value: ' \XCD\XF5\XD5\XBC\XBE\XA9 ' for column ' Sname ' at row 1

2. Insert Chinese, although inserted successfully, but display:??

Workaround:

Add #character in [mysqld] in the My.ini file-set-server=utf8

, must be above the blue circle, that is, the contents of the blue circle must be at the bottom of [mysqld], or the database cannot be logged in at all.

If the above solution is not solved? The problem,

When connecting to a database add the word useunicode=true&characterencoding=utf-8. As shown below:

"Jdbc:mysql://localhost:3306/sgmanagement?useunicode=true&characterencoding=utf-8";

Online also said: "In [mysqld] to add #default-character-set=utf8, but I do not use."

Feel:

Now of course the mood is joyful, spent 3, 4 hours on the internet to check a lot of solutions, are useless. Emperor not to bear the painstaking people, finally to try out.

Using the MySQL database, insert the data with a question mark (? ) Problem, workaround

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.