How to change default nls_date_format for oracle jdbc client(如何更改 oracle jdbc 客户端的默认 nls_date_format)
问题描述
我在 Oracle 10.2 XE 上定义了全局 nls_date_format 如下:
I have defined the global nls_date_format on Oracle 10.2 XE as follows:
alter system set nls_date_format='YYYY-MM-DD HH24:MI:SS' scope=spfile;
在 Windows 上连接时,客户端使用会话特定格式覆盖它,因此我需要在每个会话开始时运行此行:
When connecting on Windows, the clients override it with session specific format, so I need to run this line at the beginning of every session:
alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS';
但是,我有一些无法更改的自定义代码(jdbc代码,使用ojdbc14.jar),因此在接收连接时无法执行此行.有没有办法为所有 jdbc 连接更改 nls_date_format 的默认值?也许在连接字符串中添加一些东西,或者一些我可以使用的环境变量?
However, I have some custom code that I can't change (jdbc code, using ojdbc14.jar), so I can't execute this line when receiving the connection. Is there a way to change the default value of nls_date_format for all jdbc connections? Perhaps adding something to the connection string, or some environment variable that I can use?
顺便说一句,sqlplus 和 sqldeveloper 也用自己的格式覆盖了服务器的格式,但我发现了如何更改它们的默认值,所以问题仅在于 jdbc 连接.
By the way, sqlplus and sqldeveloper also override the server's format with their own, but I found out how to change their defaults, so the problem is only with jdbc connections.
推荐答案
在登录后触发器中设置 nls 日期格式
Set nls date format in an after logon trigger
这篇关于如何更改 oracle jdbc 客户端的默认 nls_date_format的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何更改 oracle jdbc 客户端的默认 nls_date_format


基础教程推荐
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01