The following error occurred while MySQL was inserting the data:
Java.sql.SQLException:Incorrect string value: ' \xc3\x8e\xc2\xa2\xc3\x88 ' for column ' details ' at row 1
At Com.mysql.jdbc.SQLError.createSQLException (sqlerror.java:946)
At Com.mysql.jdbc.MysqlIO.checkErrorPacket (mysqlio.java:2870)
At Com.mysql.jdbc.MysqlIO.sendCommand (mysqlio.java:1573)
At Com.mysql.jdbc.MysqlIO.sqlQueryDirect (mysqlio.java:1665)
At Com.mysql.jdbc.Connection.execSQL (connection.java:3170)
At Com.mysql.jdbc.Statement.executeUpdate (statement.java:1316)
At Com.mysql.jdbc.Statement.executeUpdate (statement.java:1235)
At AerchiTask.WeiBoArticle.insertArticleToDB (weiboarticle.java:468)
At AerchiTask.WeiBoArticle.getArticleList (weiboarticle.java:404)
At AerchiTask.WeiBoArticle.main (weiboarticle.java:178)
After checking, it is because MySQL inserted This database default character is GBK
This address:http://blog.csdn.net/aerchi/article/details/44062647
As shown in the following:
After adjustment, the code was changed to UTF-8.
To summarize, there are several reasons for this problem:
(1). Data encoding setting error when creating database
(2). Data encoding Setup error when connecting to database
(3). Data encoding settings error when creating a table
Re-inserting the test, succeeded.
--------------------------------------------------------------------------------------------------------------- ---------
Original articles should not be reproduced.
Author Blog address: Http://blog.csdn.net/aerchi
This address: http://blog.csdn.net/aerchi/article/details/44062647
Java.sql.SQLException:Incorrect string value: ' \xc3\x8e\xc2\xa2\xc3\x88 ... '