Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to store chinese characters in MySQL

843841Jun 14 2004 — edited Jul 2 2008
Hi,

I am going to store chinese character in MySQL ver3.23. User will input chinese characters in a HTML FORM and then the character will be stored to the MySQL Database by the Servlet Program.

Here is the servlet code:

Connection conn = new Connection(......);
String stmtStr = "UPDATE USER_PROFILE SET USER_NAME=?, USER_CHI_NAME=? WHERE LOGIN_ID=?;";
PreparedStatement stmt = conn.prepareStatement(stmtStr);

stmt.setString(1, userName);
stmt.setBytes(2, userChiName.getBytes("big5"));
stmt.executeUpdate();

it doesn't work and I found the stored character became question mark in MySQL database. How can I stored the chinese character in MySQL3.23? Or any other version?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 30 2008
Added on Jun 14 2004
4 comments
635 views