Incorrect string value: '\xE6\x9D\x8E\xE7\xA7\x8B...' for column 'createUser' at row 1

 

Eclipse插入数据库报的异常:
Caused by: java.sql.SQLException: Incorrect string value: '\xE6\x9D\x8E\xE7\xA7\x8B...' for column 'createUser' at row 1
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362)
	at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
	at com.dangdang.ddframe.rdb.sharding.executor.PreparedStatementExecutor.executeInternal(PreparedStatementExecutor.java:192)
	... 75 more

原因:

表字段createUser没有设置为utf8编码:

解决:打开表设计,将表字段设置为utf8编码,如图:

Incorrect string value: '\xE6\x9D\x8E\xE7\xA7\x8B...' for column 'createUser' at row 1_第1张图片

你可能感兴趣的:(Mysql)