Install Oracle NLS_LANGUAGE from java in webapp

My understanding of JDBC is that it automatically sets Oracle session parameters NLS_LANGUAGE / NLS_TERRITORY based on the standard Java JVM language. This is convenient for a standalone swing application, but seems useless for java webapp. The only solution I can come up with is to configure the session parameters immediately before executing the database query, something similar to:

Connection c = // However you get it.
Statement s = c.createStatement();
s.execute("alter session set NLS_LANGUAGE = 'SPANISH'");
// Do actual query here

My questions:

  • Is this the best way to set Oracle language / country parameters from webapp?
  • Since Oracle parameters use language names rather than codes, is there a mapping from java / ISO language codes to Oracle language names? For example, is it possible to use Locale.getDisplayLanguage () and be safe?
+1
2

.

- (, , , ).

(, , ) "" - (, , , ).

"".

, , , .

+1

, , .

NLS LANGUAGE, TERRITORY, CHARACTERSET SORT, V $NLS_VALID_VALUES , , /​​.

+1

All Articles