Hi all,
I don't succeed to write to my MySql db with UTF-8.
I can read Characters in UTF-8 but I can't write.
If I try to save aaaéaaa, I get in my db browser (Navicat) aaa?aaa.
With my DB browser I can read and write aaaéaaa freely.
I tried anything I can think of:
• Start mysql server with --character-set-server=utf8
• Define a new table with only UTF8 columns
• Use the JVM flag -Dfile.encoding=utf8
• Compile with: javac -encoding UTF-8
• connection url: ?useUnicode=yes&characterEncoding=utf8
• Convert the
String object itself: new String(aString.getBytes("utf8"),"utf8");
• I even tried to translate the whole query to UTF-8
• statement.executeUpdate("set names utf8");
• statement.executeUpdate("set character_set_results=utf8");
What did I miss???
I'm using:
OS: windows XP
Java: Sun 1.6.0_15
driver: mysql-connector-java-5.0.4.jar
Mysql server: 5.1.37
Here's the source code:
Any help will be appreciated,
Eran