JFinal Weixin公众号开发nickname问题

查询传入的条件没有中文乱码问题,但在执行sql后看tomcat日志报:

Caused by: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x90\xA0\xE7\xA7...' for column 'nickname' at row 1

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2683)

at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2144)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2444)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2362)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2347)

at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2723)

at com.alibaba.druid.wall.WallFilter.preparedStatement_executeUpdate(WallFilter.java:633)

at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2721)

at com.alibaba.druid.filter.FilterAdapter.preparedStatement_executeUpdate(FilterAdapter.java:1069)

at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeUpdate(FilterEventAdapter.java:491)

at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2721)

at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeUpdate(PreparedStatementProxyImpl.java:158)

at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(DruidPooledPreparedStatement.java:253)

at com.jfinal.plugin.activerecord.DbPro.save(DbPro.java:552)

at com.jfinal.plugin.activerecord.DbPro.save(DbPro.java:586)

... 37 more

字符串无效: Incorrect string value: '\xF0\x9F\x90\xA0\xE7\xA7...' for column 'nickname' at row 

评论区

JFinal

2017-01-06 21:11

数据库中存放 nickName 字段的字符集由 utf8 改为 utf8mb4 ,可极速开打完收枪

lyh061619

2017-01-06 22:11

@JFinal 哈哈,波总好极速哦,我也刚看到就是波总您指出的这个方法。

zhengwunong

2020-08-05 17:16

改了没有用呀

热门反馈

扫码入社