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 =
Statement s = c.createStatement();
s.execute("alter session set NLS_LANGUAGE = 'SPANISH'");
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?