System operation and maintenance series of mysql operation JDBC connection database frequently reports errors

I am happy to modify the code, package and upload it, everything is OK, it seems that everything is going well, and then other colleagues mysql upgrade in the evening, the data is not stored in the database the next day. The code is okay, and I tested it locally, and various connection errors appeared again.
ERROR :
Unknown initial character set index '255' received from server. Initial client character ***
In fact, literally translated is what 255, what character set is ~~~ Although it is not a literal translation hahaha
Solution:
in the configuration file database Add the following code after the name:
?useUnicode=true&characterEncoding=utf8
?useUnicode=true&characterEncoding=utf8 Please
choose one of the two commands, and don’t forget to add the question mark.

When I thought that there would be another village in the dark, I ended up in a situation where there is nowhere to go. There are bugs from time to time, and there are so many today. Don't be discouraged and come again!

ERROR :
Unexpected exception encountered during query ***
What does this mean, I don't know, anyway, it is an error in the query.
Solution:
Update the jar package: Just update mysql-connector-java-*jar.

The problem should be solved.

Reference link:
https://blog.csdn.net/qq_41902020/article/details/104785187 Solve the java query database error: Unexpected exception encountered during query
https://www.jianshu.com/p/189f31ef16e2 Unknown initial character set index ' 255' received from server. Initial client character solution

Guess you like

Origin blog.csdn.net/langxiaolin/article/details/113698373