NLS_LANG setting for JDBC thin driver?

你。 提交于 2019-11-27 07:50:29

The NLS_LANG settings are derived from the java.util.Locale . Therefore, you will need to make a call similar to this before connecting:

Locale.setDefault(Locale.<your locale here>);
Michał Niklas

See also: https://serverfault.com/questions/63216/ora-12705-cannot-access-nls-data-files-or-invalid-environment-specified/64536

For me the best response was by FoxyBOA to invoke java app with:

-Duser.country=en -Duser.language=en

I was fighting the same problem and found out that thin jdbc Oracle drivers do not require NLS_LANG or system locale to be specified. But when you connect to non-english databases you are to have orai18n.jar in the classpath.

from Oracle® Database JDBC Developer’s Guide and Reference

Providing Globalization Support

The basic Java Archive (JAR) files, ojdbc5.jar and ojdbc6.jar, contain all the necessary classes to provide complete globalization support for:

  • Oracle character sets for CHAR, VARCHAR, LONGVARCHAR, or CLOB data that is not being retrieved or inserted as a data member of an Oracle object or collection type.
  • CHAR or VARCHAR data members of object and collection for the character sets US7ASCII, WE8DEC, WE8ISO8859P1, WE8MSWIN1252, and UTF8.

To use any other character sets in CHAR or VARCHAR data members of objects or collections, you must include orai18n.jar in the CLASSPATH environment variable of your application.

svante

Invoking java with the following works for me :

-Duser.country=us -Duser.language=en

if "en" for country also causes ORA-12705.

You should use the old Oracle 9.2 JDBC driver that is fully compatible and certified with Oracle 10g. The old driver does not use ALTER SESSION SET NLS_LANGUAGE commands.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!