Oracle® Globalization Development Kit Java API Reference
10g Release 1 (10.1.0.0)

Part No. B10971-02

oracle.i18n.servlet.localesource
Class DBLocaleSource

java.lang.Object
  |
  +--oracle.i18n.servlet.localesource.LocaleSource
        |
        +--oracle.i18n.servlet.localesource.DBLocaleSource
All Implemented Interfaces:
Serializable

public class DBLocaleSource
extends LocaleSource

The DBLocaleSource class is the predefined database locale source that accesses a user profile table including user locale preferences. All user profile information can be specified in the GDK application configuration file.

The database locale source should use the special tag <db-locale-source> to include the user profile information in the list of the locale determination rule. The following attributes are required:

The attributes for the locale must be specified in one of the following parameters depending on the scenario:

Scenario 1: If the user locale preference is stored in the form of ISO locale, use:

Scenario 2: If the user locale preference is stored in the form of Oracle language and Oracle territory names, use:

Scenario 3: If the user locale preference is stored in the form of Oracle abbreviation language and territory names, use:

Additionally, the following attributes may need to be specified:

For example, assuming the user locale and time zone preferences are used for globalized operations, the user schema table is specified as follows:

 create table user_profile
 (
   userid varchar2(100) primary key, -- user id
   ... (various user information)
   locale  varchar2(10), -- user locale preference, e.g., ja-JP
   timezone varchar2(50) -- user time zone preference, e.g., America/Los_Angeles
 )
 

The data source file has the following connection information:

 <data-source class="com.evermind.sql.DriverManagerDataSource" 
   name="OracleDS"
   location="jdbc/OracleCoreDS" 
   xa-location="jdbc/xa/OracleXADS"
   ejb-location="jdbc/OracleDS"
   connection-driver="oracle.jdbc.driver.OracleDriver"
   username="yourapp"
   password="<db password>"
   url="jdbc:oracle:thin:@localhost:1521:orcl" 
   inactivity-timeout="30"
   />
 

The locale determination rule would become the following:

 <locale-determine-rule>
   <locale-source 
    data-source-name="jdbc_OracleCoreDS" 
    locale-source-table="user_profiles"
    user-key="userinfo" 
    user-column="userid"
    locale-column="locale" 
    timezone-column="timezone" 
  >oracle.i18n.servlet.localesource.DBLocaleSource<locale-source>
  <locale-source>oracle.i18n.servlet.localesource.HttpAcceptLanguage<locale-source>
 <locale-determine-rule>
 

Also, the application provides the authentication filter that specifies "userinfo" to either the user id or null in the session object so that the database locale source object can determine if the user is authenticated or not.

Since:
10.1.0.2
See Also:
Serialized Form

Nested Class Summary

Nested classes inherited from class oracle.i18n.servlet.localesource.LocaleSource
LocaleSource.Alignment, LocaleSource.Parameter, LocaleSource.WritingDirection

Methods inherited from class oracle.i18n.servlet.localesource.LocaleSource
equals, getAttribute, getCharacterSet, getCollator, getCurrencyFormat, getDateFormat, getDateTimeFormat, getISOCurrency, getLocale, getLocaleSourceClass, getNumberFormat, getTimeFormat, getTimeZone, getWritingDirection, hashCode, isCached, isReadOnly, load, setAttribute, setCharacterSet, setCollator, setCurrencyFormat, setDateFormat, setDateTimeFormat, setISOCurrency, setLocale, setLocale, setLocaleSourceClass, setNumberFormat, setTimeFormat, setTimeZone, setWritingDirection, store

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait


Oracle® Globalization Development Kit Java API Reference
10g Release 1 (10.1.0.0)

Part No. B10971-02

Copyright © 2003, 2004, Oracle. All rights reserved.