I used MySQL when developing javaee. At that time, the server used Linux. I wrote everything, but the characters displayed on the interface were always "?". ", At that time, I thought the encoding for storing the database was incorrect! I found that the database encoding in MySQL is also utf8 (I configured UTF-8 in struts2)
At that time, I had a headache. javaee had been working for a long time. Why was there such a problem? At that time, I checked a lot of information and I was not satisfied with it, I finally read the English explanation on Google (poor English, usually skipping English). Foreigners mean that they need to append the character encoding format to the string connected to the database through hibernate, for example, if the database hello is requested, the connection character of the request is:
<Property name = "connection. url"> JDBC: mysql: // 127.0.0.1: 3306/Hello? Useunicode = true & characterencoding = UTF-8 </property>
But after the connection, I found that the interface and the background promised "?",. At that time, I was very depressed. I had no choice but to continue reading some foreign articles. Finally, I realized that there was no problem with this writing method, and the key error problems existed "&". I want to change the above "&" to "& amp;". I have tried some of them, and this method can solve the problem. "?" This situation
Complete statement: JDBC: mysql: // 127.0.0.1: 3306/Hello? Useunicode = true & amp; characterencoding = UTF-8
If this problem occurs in the future, you need to add character encoding for the link URL of hibernate!
Learning lies in accumulation!