Monday 21 October 2019

Supporting Multi Language For Any Web Application Running With Oracle Database

How to support Multi-language in Oracle ?


We may all come across the situation of how to support Multi language in Oracle while working with web application. For that UTF-8 is the best way to do that. 

Here is the steps which I followed to achieve for capturing multiple language into Oracle data base as well as view the same  on the UI pages.



Steps to set the default character-set to support UTF-8 in Oracle database:


  • Connect to the Oracle data base using SYS user using command prompt.
          
Fig: Login to oracle with sys user.


  • Check the character-set value of the database by using below command. 
           select * from nls_database_parameters where parameter='NLS_CHARACTERSET';

          The above command should return the result with AL32UTF8. If not means we need to set it.  
          
           
Character-set utf-8

  • To set the character-set to AL32UTF8, Use the below command, If already done or present by default means can skip this step.
           Update Sys.Props$ Set VALUE$='AL32UTF8' Where NAME='NLS_CHARACTERSET';

  • Restart the database using following command once the changes had been done for character-set using above step.
                      shu Immediate;
                      startup;

Steps to add/change configuration file in web application:

        Once we done with the changes to the database is not sufficient to enable or support multi language, We need to add Character Encoding Filter in configuration file of web.xml (If you are working with spring or servlet based application).

configuration file (web.xml)

Configuration in application server (Apache tomcat):

Although by following above steps we can make any application to work in multilingual (read/write/post/log to database), but to make data table view/filter, we need to configure the UTF-8 encoding in configuration file of tomcat too.

Configuration in server.xml file


 That's all. After following all the above steps, you should be able to support your web application with any language like log the data entered in any language to database, view the page data fetching from database with any stored language.




No comments:

Post a Comment

Working with Ajax and Spring MVC

Working with Ajax and Spring MVC Simple example for ajax call or form posting using spring mvc as below. Validation using Ajax call...