During the top Shard, The PreparedStatement encountered garbled Characters During database storage, which had plagued the database for a long time and finally solved the problem.
The problem code is as follows: [java] pstmt = con. prepareStatement (INSERT_OFFLINE); pstmt. setString (1, username); pstmt. setLong (2, messageID); pstmt. setString (3, StringUtils. dateToMillis (new java. util. date (); pstmt. setInt (4, msgXML. length (); pstmt. setString (5, "Chinese content"); pstmt.exe cuteUpdate (); www.2cto.com during debugging, the "Chinese content" in pstmt.exe cuteUpdate (); line pstmt is changed ???? The reason is that jdbc is used to set the datasource driver. url = jdbc: mysql: // 192.168.12.22: 3306/ts does not specify the encoding. You can modify jdbc as follows. url = jdbc: mysql: // 192.168.12.22: 3306/ts? CharacterEncoding = utf8 Problem Solving author a352193394