• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Executing Mysql query contains chinese character in java

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .

 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Are we home yet? Wait, did we forget the tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic