• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

How to distinguish the character encoding the MySql is using and the System is using?

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I want to write a java to connect to the MySql ,needing to insert some data to it and then I need to convert the system's character into the database's character,but I don't know which character encoding the database is using. So how can I get the character encoding the system is using as well as the MySql.

Thanks
jun
 
Marshal
Posts: 76888
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
System#getProperty(String). If you can't get anything useful with "encoding" try System.getProperties and iterate through the Enumeration it returns.
You should be able to select the database's properties in MySQL but I can't remember how.
 
ken jun
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:System#getProperty(String). If you can't get anything useful with "encoding" try System.getProperties and iterate through the Enumeration it returns.
You should be able to select the database's properties in MySQL but I can't remember how.



Thank you Campbell

I know I can select the character encoding of the database but if I want to distribute a program for others to run, I have no idea what the user's properties. So could you tell me some method to solve the problem that how to know the character encoding which the database is using...
 
Campbell Ritchie
Marshal
Posts: 76888
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't know myself, sorry.
 
ken jun
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Don't know myself, sorry.


haha no problem anyway thanks a lot
 
Ranch Hand
Posts: 312
MS IE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe, using JDBC compliant DML statements, will allow your Java program to be easily run against standard RDBMSs such as MYSQL. In other words, you need not worry, if you use JDBC compliant DML statements in your Java programs.
 
What are you doing? You are supposed to be reading this tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic