NLS_LANG cannot be changed by ALTER SESSION, NLS_LANGUAGE and NLS_TERRITORY can. However NLS_LANGUAGE and /or NLS_TERRITORY cannot be set as "standalone" parameters in the environment or registry on the client.
Evidently the "right" solution is, before logging into Oracle at all, setting the following environment variable:
export NLS_LANG=AMERICAN_AMERICA.UTF8
assigning the values of instance variable initializers to the corresponding instance variables, in the left-to-right order in which they appear textually in the source code
// Set up the environment for creating the initial context Hashtable<String, Object> env = new Hashtable<String, Object>(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial"); // Authenticate as S. User and password "mysecret" env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, "cn=S. User, ou=NewHires, o=JNDITutorial"); env.put(Context.SECURITY_CREDENTIALS, "mysecret"); // Create the initial context DirContext ctx = new InitialDirContext(env); // ... do something useful with ctx
E. Chong, S. Das, G. Eadon, and J. Srinivasan. VLDB '05: Proceedings of the 31st international conference on Very large data bases, page 1216--1227. VLDB Endowment, (2005)
A. Memon, I. Banerjee, and A. Nagarajan. Automated Software Engineering, 2003. Proceedings. 18th IEEE International Conference on, page 164-173. (October 2003)
P. Santos-Neto, R. Resende, and C. Pádua. SAC '07: Proceedings of the 2007 ACM symposium on Applied computing, page 1409--1415. New York, NY, USA, ACM, (2007)
B. Thome, D. Gawlick, and M. Pratt. SIGMOD '05: Proceedings of the 2005 ACM SIGMOD international conference on Management of data, page 863--867. New York, NY, USA, ACM, (2005)