Home > Database > Mysql Tutorial > How to solve ibatis mysql garbled characters

How to solve ibatis mysql garbled characters

藏色散人
Release: 2023-02-16 10:41:41
Original
1678 people have browsed it

ibatis Solution to mysql garbled code: 1. Check the character set of mysql and set it to utf8; 2. Modify the configuration to "”.

How to solve ibatis mysql garbled characters

The operating environment of this tutorial: Windows 10 system, MySQL version 5.7, Dell G3 computer.

ibatis How to solve mysql garbled code?

ibatis mysql Chinese garbled problem

Written a test sample today, and found that using ibatis to insert into the database showed garbled characters, consult the information to solve the problem, the summary is as follows:

(1) Check the character set of mysql. I use Navicat for MySQL. The checking method is as follows:

Select the database-"Right-click-"View database properties, set to utf8;

( 2) If the database character set is not utf8, the built table should not be utf8. If it is not a production environment, it is recommended to delete the table and rebuild it;

(3) Modify the connection string configuration to the following content, if it is an xml configuration file Add the cdata tag and be careful not to have spaces.

    <property name="url">
     <value><![CDATA[jdbc:mysql://localhost:3306/yourDbName?useUnicode=TRUE&characterEncoding=utf8]]></value>
   </property>
Copy after login

Recommended learning: "MySQL Video Tutorial"

The above is the detailed content of How to solve ibatis mysql garbled characters. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template