• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
ken jun
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • 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
 
Campbell Ritchie
Sheriff
Pie
Posts: 48940
60
  • Mark post as helpful
  • send pies
  • 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
  • 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
Sheriff
Pie
Posts: 48940
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know myself, sorry.
 
ken jun
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Don't know myself, sorry.

haha no problem anyway thanks a lot
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic