Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Executing Mysql query contains chinese character in java

 
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!
 
Everybody's invited. Even this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!