This code works fine, which shows you can use the useUnicode and
characterEncoding properties with simple Statement's:
....
Properties prop = new Properties();
Class.forName("org.gjt.mm.mysql.Driver");
// true as String and not: Boolean.valueOf(true)!
prop.put("useUnicode", "true");
prop.put("characterEncoding", "UTF-8");
con = DriverManager.getConnection(dbUrl, prop);
String s = "\u20AC (euro) \u2126 (ohm)";
Statement stm = con.createStatement();
stm.executeUpdate("DROP TABLE IF EXISTS TestUnicode");
stm.executeUpdate("CREATE TABLE TestUnicode (code VARCHAR(128))");
stm.executeUpdate("INSERT INTO TestUnicode (code) VALUES (\'"+s+"\')");
ResultSet rs = stm.executeQuery("SELECT code FROM TestUnicode");
if (!rs.next()) {
     System.err.println("No row?!");
} else {
     System.out.println(s.equals(rs.getString("code")) ? "OK" : "FAILED");
}
...

The downside is that the stored String does NOT appear correct in the
SQL tools (for instance MySqlManager). I *think* the problem is that
MySQL is not using UNICODE. 
Is there a workaround for this issue??

Ronald


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to