MySql error Incorrect string value for column

Source: Internet
Author: User
Tags sql error

The following error occurs when using javabean,

66480555 [http-80-4] WARN org. hibernate. util. JDBCExceptionReporter-SQL Error: 1366, SQLState: HY000
66480555 [http-80-4] ERROR org. hibernate. util. JDBCExceptionReporter-Incorrect string value: '\ xE7 \ x89 \ xA9 \ xE8 \ xB5 \ x84... 'for column 'search' at row 1
Org. hibernate. exception. GenericJDBCException: cocould not execute query
At org. hibernate. exception. SQLStateConverter. handledNonSpecificException (SQLStateConverter. java: 103)
At org. hibernate. exception. SQLStateConverter. convert (SQLStateConverter. java: 91)
At org. hibernate. exception. JDBCExceptionHelper. convert (JDBCExceptionHelper. java: 43)
At org. hibernate. loader. Loader. doList (Loader. java: 2208)
At org. hibernate. loader. Loader. listIgnoreQueryCache (Loader. java: 2102)
At org. hibernate. loader. Loader. list (Loader. java: 2097)
At org. hibernate. loader. custom. CustomLoader. list (CustomLoader. java: 289)
At org. hibernate. impl. SessionImpl. listCustomQuery (SessionImpl. java: 1699)
At org. hibernate. impl. AbstractSessionImpl. list (AbstractSessionImpl. java: 142)
At org. hibernate. impl. SQLQueryImpl. list (SQLQueryImpl. java: 152)
At ceapet. jbpm. fileUploadBean. mRecordsList (fileUploadBean. java: 313)

Java. SQL. SQLException: Incorrect string value: '\ xE4 \ xBA \ x8C \ xE6 \ xAC \ xA1. ..' for column 'search' at row 1

You cannot search in Chinese, but insert into Chinese is acceptable. All charsets in my database and data table are set to utf8.
I have no problem with the program in Windows xp, but in Linux, errors are reported for the same program and database.

There are a lot of questions about this issue found on the Internet, of course, it is basically an insert into error, basically it is recommended to set names gbk, or delete the database and recreate.

However, this is not the reason for my situation. After careful consideration, My SQL statement executes the stored procedure, and whether the stored procedure should have character sets like the table,
The character set of stored procedure parameters should also be set.
Copy codeThe Code is as follows:
Create definer = 'root' @ 'localhost' PROCEDURE 'ceapet _ upload_proce '(IN userId varchar (30), IN dir varchar (30), IN search varchar (30) charset utf8)

The problem is solved in this way!

Related Article

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.