Using this command to create database
create database databaseName default character set utf8 default collate utf8_general_ci;
Here is the setting about JDBC URL
jdbc:mysql://localhost:3306/databaseName?useUnicode=true&characterEncoding=UTF-8
Note: Collate should be set properly. Wrong collate will cause wrong result for "order by" in sql statement. For example, utf8_danish_ci represents the Danish collations. It does not support Chinese character yet. So if you want a database support both simplified chinese and traditional chinese, you can only use utf-8 which will bring you some trouble if you want to sort the result set by chinese character columns. I saw somebody sort it in code of Ruby. Of course we can sort the resultset in Java but I think it will impact performance a lot.
Waiting for utf8_chinese_ci ...
No comments:
Post a Comment