Tuesday, October 27, 2009

MySQL and Java common problem

Have you ever received the following error while using Java and MySQL:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1

This is a common error when you first set up Java and MySQL to work together. To correct it simply add the following lines of code to your my.cnf in the section [mysqld]
collation_server=utf8_general_ci
character_set_server=utf8