• Post Reply Bookmark Topic Watch Topic
  • New Topic

Executing Mysql query contains chinese character in java  RSS feed

 
selva nayagam.K
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried to run "insert into Users values ('塞尔瓦', ...)". query from application. It is executed successfully
But when I viewed in mysql browse the inserted value shown is '???'.
Than I have tried to run the same query in the mysql browser, the value is saved in the correct format .

 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe where you see ???, the chineese characters are not supported for display.
 
selva nayagam.K
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used the following code
String driverUrl = "jdbc:mysql://localhost/database?characterSetResults=UTF-8&characterEncoding=UTF-8&useUnicode=yes"
It worked fine for me. I have solved the problem
 
Krish Khan
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Selva,


Before inserting your Chinese characters into database you need to modify your column data type and coalition type (according to language you need).

I tried in MS Sql its working Please try with Mysql change your columns data type and coalition accordingly and then your insert statement should be

inset into <table name> (name) values (N'RANCHERS');


Thank You!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!