Applies to:
JDBC - Version: 10.2 to 11.1.0
Information in this document applies to any platform.
Goal
When using 10gR2 or 11g Thin JDBC driver, the session NLS_SORT parameter is not set with the expected value (for instance 'CROATIAN' instead of 'BINARY').
How to make sure that your session uses the expected session NLS_SORT parameter value?
Solution
Here are three options to set the NLS_SORT session parameter with the 10gR2 Oracle JDBC Thin driver.
- Using java locale setting
The value of the used NLS_SORT parameter depends on the locale that has been set when running the java program. Therefore by setting the language and the region on startup of the java process the NLS_SORT parameter can be influenced. To do so start the java program as following:
java -Duser.lang=en -Duser.region=US <jdbc_program>
- Set NLS_SORT within your Java application
Add code to your java program that alters the database session when retrieving a connection to connect to the database. The code would look like:
...
String s_alter = "alter session set NLS_SORT=BINARY";
Statement stmt = null;
stmt = p_connection.createStatement();
stmt.execute( s_alter );
...
- Set the value via a trigger when connecting to the database server
To make sure that this parameter NLS_SORT is set for every connection done to the database, you can also use a database trigger that sets the value after the users connect. Note that this 'trigger option' will work when accessing database server with the JDBC Thin driver (not with the OCI JDBC driver, you can refer to the enhancement request Bug 3967004). Here is sample of a Logon trigger (change <user> with the name of the actual user for which the parameter should be set):
CREATE OR REPLACE TRIGGER <user>.TRG_ONLOGON_CHANGE_NLS_SORT
AFTER LOGON ON <user>.SCHEMA
BEGIN
execute immediate 'ALTER SESSION SET NLS_SORT = BINARY';
END;
/
分享到:
相关推荐
oracle10g jdbc的一个包 nls_charset12.jar。 oracle11g jdbc的一个包 orai18n.jar
快速通过NLS_LANG切换字符集快捷工具设置客户端字符集,避免连接多个不同字符集的数据库导致PL/SQL工具显示乱码的问题。
nls_charset12.jar 之前在csdn上下载的这个文件有问题,导致程序调试了很久 我这边上传这个没有问题
Oracle的NLS_DATE_FORMAT设置(日期格式设置)_ITPUB博客.mhtml
oracle 10G jdbc连接jar包 nls_charset12.jar,ojdbc14.jar
nls_charset12.jar oracle 驱动
ojdbc14.jar nls_charset12.jar
我已经通过了PB12.5连ORACLE10的免客户端设定。详细内容请看里面的 《PB连ORACLE10免客户端》
解决oracle11g存储过程传入数组空的问题。找好好久,测试才好使,提供给大家。 oracle class12.jar nls_charset12.jar存储过程接收数组空值
PowerBuilder如何连接Oracle数据库。
oracle关于字符集的jdbc驱动,orai18n.jar nls_charset12.jar 支持集合的驱动程序 将java的集合转换为数据库集合类型 oracle10g及以下版本使用 nls_charset12.jar,以上的版本使用orai18n.jar
window下修改NLS_LANG环境变量快捷工具,此工具利用bat写的,可以看见源码,提供给大家参考
PB程序连接oracle数据库,不用配置本地oracle服务
Charset cp1251 translation tables.
Charset cp852 translation tables.
Script that solves and plot pulse propagation thru Split step Fourier method agrawal book
非线性薛定谔方程的数值求解,并计算脉冲的展宽