Friday, December 24, 2010

Implementation of Multiple languages in MYSQL

How to enable Multiple language support in mysql??

FIrst you need to go through What is unicode ??how it works ?? for better understandingThen you can go through this Article Which is totally practical

Steps:
1.Get all the character sets of MySQL
mysql>SHOW CHARACTER SET;

2.See all the collations for particular Char sets
mysql>SHOW COLLATION LIKE '%latin%';

Will give you result for latin Charsets
3.We will be going to set utf8 CHARSET;

First Highest priority will be given to query which COLLATIONS and Charset it wants then will be columns and if not mention will be table if not mention will be database
So If you are going to fire this query

  mysql>SELECT c1 COLLATE utf8_bin FROM aa
 
  Will override all the collations you mention and will use utf8_bin.now if not mention then table collation would be used and so on....

4.Remember one thing to meet this collation requirment one must set the client side collation and charset should meet up with server side mentioned parameters means both the collations and charset must be matching

SET character_set_client = 'utf8';
SET character_set_connection = 'utf8';
SET character_set_database = 'utf8';
SET character_set_results = 'utf8';
SET character_set_server = 'utf8';  

This will keep character_set on server side of utf8 and will procedd work on that basis you can set this into my.cni file or you can fire this stmts on Starting of Session will work
now for all your char set is utf8 and now you need to set collation

SET collation_connection='utf8_bin'
SET collation_database ='utf8_bin'
SET collation_server='utf8_bin'


Which would set the collation of the server.

7.Now your database is ready to deal with multi languages.Now create one table

CREATE TABLE t1
(
c1 varchar(20);
)

INSERT INTO aa values ('Њ');

Will get data into that now fire select query you will get this as a dataIf you are getting question mark or junk value then its not configured yet.


8.Now change table or column level collation whichever is high in priority and check it will display the junk data so now your table is ready to accept multilanguage values

Now enable hindi language in OS

Step A: To enable Indic Languages in Windows XP
Go to Start-> Control Panel > Regional & Language Options >Click
on Languages Tab (the following screen will appear)
Tick the Check box to Install files for complex scripts... and click OK.



2. (Following message would appear) Click OK




3. You will be required to place the Windows XP CD in the CD drive to enable
Indic languages including Hindi
Reboot the System


Thnks and Regards 
Kamesh

No comments:

Post a Comment