ibatis Solution to mysql garbled code: 1. Check the character set of mysql and set it to utf8; 2. Modify the configuration to "
”.
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>
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!