刚才控制台又报这个错,这是代表MySQL驱动和数据库字符集设置不搭配;
错误:
"...Initial client character set can be forced via the ‘characterEncoding‘ property."
解法:
在sqlMapConfig.xml中添加
<environments default="mysql"> <environment id="mysql"> <transactionManager type="JDBC"></transactionManager> <dataSource type="POOLED"> <property name="driver" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/mybatisday1?useUnicode=true&characterEncoding=utf8"/> <property name="username" value="root"/> <property name="password" value="shitou25"/> </dataSource> </environment> </environments>
这是idea的解法,eclipse可能有点不一样吧!
原文地址:https://www.cnblogs.com/shijinglu2018/p/10392393.html
时间: 2024-11-05 14:44:17