title: Set Oracle NLS_LANGUAGE from java in a webapp
body: <p>My understanding of JDBC is that it automatically sets the Oracle NLS_LANGUAGE/NLS_TERRITORY session parameters based on the default Locale of the JVM. This is handy for a stand-alone swing app, but seems useless for a java webapp. The only solution I can come up with is to specifically set the session parameters right before actually doing a database query, something similar to:</p>
  
  <pre><code>Connection c = // However you get it.
  Statement s = c.createStatement();
  s.execute("alter session set NLS_LANGUAGE = 'SPANISH'");
  // Do actual query here
  </code></pre>
  
  <p>My questions:</p>
  
  <ol>
  <li>Is this the best way to set the Oracle language/country parameters from a webapp?</li>
  <li>Since the Oracle parameters take language names rather than codes, is there a mapping from java/ISO language codes to Oracle language names? For example, can I use Locale.getDisplayLanguage() and be safe?</li>
  </ol>