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;
/
分享到:
相关推荐
李白高力士脱靴李白贺知章告别课本剧.pptx
1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。
C语言项目之超级万年历系统源码,可以做课程设计参考 文章参考:https://www.qqmu.com/4373.html
Jupyter-Notebook
51单片机加减乘除计算器系统设计(proteus8.17,keil5),复制粘贴就可以运行
《中国房地产统计年鉴》面板数据资源-精心整理.zip
Jupyter-Notebook
Jupyter-Notebook
毕业论文答辩ppt,答辩ppt模板,共18套
Jupyter-Notebook
《中国城市统计年鉴》面板数据集(2004-2020年,最新).zip
Python基础 本节课知识点: • set的定义 • Set的解析 • set的操作 • set的函数
1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。
兵制与官制研究资料最新版.zip
Jupyter-Notebook
七普人口数据+微观数据+可视化+GIS矢量资源-精心整理.zip
Support package for Hovl Studio assets.unitypackage
土壤数据库最新集.zip
Jupyter-Notebook
1991-2020年中国能源统计年鉴-能源消费量(分省)面板数据-已更至最新.zip