Java.sql.SQLException:Incorrect string value: ' \xc3\x8e\xc2\xa2\xc3\x88 ... '

Source: Internet
Author: User

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 ... '

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.