java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.解决方案

描述:java项目连mysql时报错“java.sql.SQLException: Unknown character set index for field ‘255‘ received from server”

原因:这是编码不匹配的原因,MySQL驱动和数据库字符集设置不搭配,默认字符集已从latin1变成utf8mb4,因而系统变量受到影响

解决:直接在连接的URL后加上

useUnicode=true&characterEncoding=utf8

就可以了。

或者直接升级jar包!!

 

java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.解决方案

上一篇:Oracle 实现数据表插入时主键列自增


下一篇:解决Oracle+Mybatis批量插入报错:SQL 命令未正确结束