SPRINGMVC + mybatis + Druid Insert database Chinese garbled, query no garbled

Source: Internet
Author: User

The database connection URL that was previously configured in the Pom file, many configurations are written in the Pom file causing the configuration file to be too long

The new project writes the configuration to a different folder in the properties file.

Db.url directly copied in the Pom file.

Jdbc:mysql://127.0.0.1:3306/portal?useunicode=true&characterencoding=utf-8& Autoreconnect=true

Then the testcase test insert has been garbled.

View database character Set all OK

Another project data insertion is OK, can confirm the new project configuration problem.

On the Internet to find the results are said in the Db.url with character set parameters, I also bring or not.

Think of the most direct way is to fall back to the same configuration as the previous project, incredibly Chinese inserted normal, so you can confirm that the configuration is a problem.

Guess before you look.

XML inside Useunicode=true&characterencoding=utf-8&autoreconnect=true connector is "& amp; "

Java file in the "&", is not mentioned in the properties file the connector

Test with "&" To do the connector, testcase Insert, OK, garbled solution!

SPRINGMVC + mybatis + Druid Insert database Chinese garbled, query no garbled

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.