我们如何使用JAVA在MySQL中添加Unicode文本并使用JAVA读取它
First, the character set of your MySQL VARCHAR
column should be UTF-8 .
ALTER TABLE t MODIFY latin1_varchar_col VARCHAR(M) CHARACTER SET utf8;
Then, you should just be able to use Statement.setString()
without worry :
PreparedStatement updateSales = con.prepareStatement("UPDATE COFFEES SET SALES = ? WHERE COF_NAME LIKE ? ");
updateSales.setInt(1, 75);
updateSales.setString(2, "Colombian");
updateSales.executeUpdate():
Things to be careful of:
That's all I can think of at the moment.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.