Problem Description: Java.sql.SQLException:Incorrect string value: ' \XF0\X9F\X90\XBB ' for column ' nickname ' at row 1 at Com.mysql.jdbc.SQLError.createSQLException (sqlerror.java:1094) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (mysqlio.java:4226) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (mysqlio.java:4158) at Com.mysql.jdbc.MysqlIO.sendCommand (mysqlio.java:2615) at Com.mysql.jdbc.MysqlIO.sqlQueryDirect (mysqlio.java:2776) at Com.mysql.jdbc.ConnectionImpl.execSQL (connectionimpl.java:2840) at Com.mysql.jdbc.PreparedStatement.executeInternal (preparedstatement.java:2082) at Com.mysql.jdbc.PreparedStatement.execute (preparedstatement.java:1302) at Sun.reflect.GeneratedMethodAccessor49.invoke (Unknown Source) at Sun.reflect.DelegatingMethodAccesSorimpl.invoke (delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke ( method.java:498) at Org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke ( preparedstatementlogger.java:55) at Com.sun.proxy. $Proxy 58.execute (Unknown Source) & nbsp at Org.apache.ibatis.executor.statement.PreparedStatementHandler.update ( preparedstatementhandler.java:41) at Org.apache.ibatis.executor.statement.RoutingStatementHandler.update (routingstatementhandler.java:66) at Org.apache.ibatis.executor.SimpleExecutor.doUpdate (simpleexecutor.java:45) at Org.apache.ibatis.executor.BaseExecutor.update (baseexecutor.java:100) at Org.apache.ibatis.executor.CachingExecutor.update (cachingexecutor.java:75) Workaround: 1. Add the following restrictions when building the table: Engine=innodb DEFAULT charset=
UTF8MB4Collate=
Utf8mb4_bin; 2. Modify the following on the MY.CNF:------------------my.cnf------------------------------------------------------# for advice on how To change settings see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html[client] default-character-set=
UTF8MB4[Mysql]default-character-set =
UTF8MB4# Remove Leading # and set to the amount of RAM for the most important data# caches in MySQL. Start at 70% of all RAM for dedicated server, else 10%.# innodb_buffer_pool_size = 128M # Remove Leading # to turn on a Very important data integrity option:logging# changes to the binary log between backups.# log_bin# these is commonly set , remove the # and set as required.# Basedir = .... # DataDir = .... # ... # = = .... # server_id = ..... # socket = ... # R Emove leading # To set options mainly useful for reporting servers.# the server defaults is faster for transactions and F AST selects.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size = 128m# Sort_buffer_size = 2m# read_rnd_buffer_size = 2M Sql_mode=no_engine_substitution,strict_trans_tableslog-error=/var/log/mysqld.loglong _query_time=3 [mysqld]character-set-client-handshake = Falsecharacter-set-server =
UTF8MB4Collation-server =
Utf8mb4_unicode_ciInit_connect= ' SET NAMES
UTF8MB4' #log-slow-queries=/usr/local/mysql/log/slowquery.log--------------------------------------------------------- ---------------Restart MySQL services, service MySQL stop; service MySQL start; problem solved. The cause of the problem (on-line): MySQL Specifies that the maximum number of bytes for UTF8 characters is 3, but some Unicode characters are converted to UTF8 encoded with 4 bytes, resulting in an error.
Error in MySQL: java.sql.SQLException:Incorrect string value: ' \XF0\X9F\X90\XBB ' for column