I designed a java desktop application using jdbc technology to connect to mysql database.
But when I want to store a data in my db which is in persian language it saved like some ????
I tried creating the database with both
CREATE DATABASE 'db' CHARACTER SET 'utf8';
and
CREATE TABLE `Table1` (
[...]) DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
I tried every other COLLATEs but they seem not working properly.
What should I do?
Make sure the driver properties are set. Check that
useUnicode
istrue
,characterEncoding
is "UTF-8". I assume you are using the Connector/J JDBC driver.Refer to this answer. A brief version of what the answer says is that you should add
To the end of JDBC connection URL. For example: