Database coding problem solving method

一、Error updating database. Cause: java.sql.SQLException: Incorrect string value: ‘\xE8\x82\xA1\xE4\xBB\xBD…’ for column ‘F_BZ’ at row 1

An error was reported when inserting a rich text control.

After Baidu, it was said that it was a database encoding problem. When I saw a database encoding problem, I closed the page directly because I thought there was no problem with the database encoding.
There are a lot of tables in the database, other tables are fine, it has been shown that there is no problem, how could it be a database problem.

After that, I spent about two hours studying the rich text control and studying the source code. It may be an error caused by a small bug in the code. After a lot of testing, the code is no problem.

Then I kept building tables, setting different fields and different data types, and the problem could not be solved.

Ultimately, it is a matter of coding. The demo is as follows:

Error message:
Insert picture description here
Problem with the encoding format of the table:
Insert picture description here
Just modify it like this. You can modify the table or the database.
Insert picture description here
Summary:
Everything is possible, so it must not go wrong, but it happens.

Why does the encoding suddenly change, because the database on the server is not operating alone.
It is possible that another colleague needs to modify the code.

Guess you like

Origin blog.csdn.net/numbbe/article/details/108441618