Re: how to insert and get japanese characters.
Posted by: Tetsuro Ikeda
Date: May 25, 2005 10:59AM

Hi I'm from Japan and there is no problem for me to use Japanese with Connector/J

What are you doing with the code above? You don't need to use String.getBytes(encoding).

Just do this when you create a connection

---
String url = "jdbc:mysql://localhost/test";
Properties props = new Properties();
props.put("user", "root");
props.put("password", "");
props.put("useUnicode", "true");
props.put("characterEncoding", "WINDOWS-31J");

Class.forName("com.mysql.jdbc.Driver").newInstance();
DriverManager.getConnection(url, props);
---

After the creating Connection with "useUnicode=true" and "characterEncoding=XXXX" (XXX means Japanese charset in Java), you can INSERT and/or SELECT with Japanese by using Statement.executeUpdate, Statement.executeQuery and ResultSet.getString

I can use "UTF-8", "SJIS", "Shift_JIS", "CP943", "MS932", "WINDOWS-31J", "EUC_JP" for Japanese with MySQL 5.0.4.

Options: ReplyQuote


Subject
Written By
Posted
Re: how to insert and get japanese characters.
May 25, 2005 10:59AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.