Selvanayagam
Selvanayagam

Reputation: 73

Execute Mysql query contains chinese character using java program

When I execute SQL query contains chines character, the query is executed successfully. When I open the mysql query browser I could see only ???? instead of Chinese texts. If the same query executed from the mysql query browser it works fine.

Upvotes: 0

Views: 1993

Answers (2)

maaartinus
maaartinus

Reputation: 46422

All encoding must be the same (there are exceptions but let's forget them): the encoding used by the DB, the connection encoding use by the Java process and the one used by the query browser. You need to change the one used by Java, since the other two seem to be OK.

Upvotes: 0

Jigar Joshi
Jigar Joshi

Reputation: 240900

Try connecting with following switch

 String url = "jdbc:mysql://host/database?characterSetResults=UTF-8&characterEncoding=UTF-8&useUnicode=yes";

Upvotes: 4

Related Questions