Wednesday, July 11, 2007

Ant JDBC and UTF8

You have to really watch out when you want to use UTF8 for your database, enabling unicode support in database, creating table with the correct encoding settings for each columns and etc. There one more catch I just realized as I was trying to use ant JDBC to load some Chinese characters into our database.
You need to specify UTF8 and unicode in the JDBC connection string.
<sql driver="com.mysql.jdbc.Driver" url="jdbc:mysql://${}?useUnicode=true&characterEncoding=UTF-8" userid="${db.user}" password="${db.password}"$gt;
<transaction src="${target.dir}/database/script.mysql"/>

No comments: