Reputation: 1554
How we can add unicode Text in MySQL using JAVA and reading it using JAVA
Upvotes: 0
Views: 1329
Reputation: 3425
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.
Upvotes: 1