The Answer to Life, the Universe, and Everything

Thursday, November 29, 2007

MySQL Encoding

You need to change params for the server and the client.
# Change MySQL server encode
# By calling the following SQL you can see the current encoding.
# show create table xxx;
# show variables like 'char%';

mysql$ alter table xxx character set utf8;
mysql$ alter table xxx change sub1 sub1 varchar(256) character set utf8;
mysql$ set names utf8;
mysql$ set character_set_database=utf8
mysql$ set character_set_server=utf8

#On the client to connet to DB set the following param in URL
jdbc:mysql://localhost/blojsom?autoReconnect=true&useUnicode=true&characterEncoding=utf-8

No comments: