java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation ‘=’
在使用mybatis向数据库中插入数据时报此错误信息,通过报错信息可以看到是字符编码混淆。
<insert id="addEmp" parameterType="com.mytest.mybatis.entity.Employee">
insert into tbl_employee ( last_name, email, gender, age) values

当使用MyBatis向数据库插入数据时,遇到`java.sql.SQLException`,错误提示涉及latin1_swedish_ci和utf8mb4_general_ci字符集不匹配。解决方法包括修改表的编码、检查表的编码信息以及collation排序规则。调整后可成功插入数据。
最低0.47元/天 解锁文章
1971

被折叠的 条评论
为什么被折叠?



