0
如何,我们可以在MySQL中使用Java和JAVA如何,我们可以在MySQL中使用JAVA
如何,我们可以在MySQL中使用Java和JAVA如何,我们可以在MySQL中使用JAVA
首先,字符集的MySQL VARCHAR
列should be UTF-8阅读它添加Unicode文本添加Unicode文本。
ALTER TABLE t MODIFY latin1_varchar_col VARCHAR(M) CHARACTER SET utf8;
然后,你就应该能够使用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():
事情要小心:
这就是我现在所能想到的。
我有同样的问题,我解决它,并在我的博客张贴它看到链接 [Unicode教程](http://uwudamith.wordpress.com/2011/09/02/how-to-insert-unicode -values-to-mysql-using-java /)我认为这会很有用。 – Damith 2011-10-20 08:07:15