”."/> ”.">

Home  >  Article  >  Database  >  How to solve ibatis mysql garbled characters

How to solve ibatis mysql garbled characters

藏色散人
藏色散人Original
2023-02-16 10:40:471642browse

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

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>

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!

Statement:
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