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


基础教程推荐
- 什么是 orradiag_<user>文件夹? 2022-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 在多列上分布任意行 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01