ojdbc14.jar 与 ojdbc6.jar [英] ojdbc14.jar vs. ojdbc6.jar

查看:33
本文介绍了ojdbc14.jar 与 ojdbc6.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到以下差异,但没有在任何地方看到它的记录.我想知道其他人是否注意到了同样的事情,或者可以指出一些证明相同的文件.

I noticed the following difference but did not see it documented anywhere. I'm wondering if others have noticed the same thing or can point me to some documentations that proves the same.

环境:-

Oracle 11g、JDK 1.6、iBatis、PL/SQL

场景:-

ojdbc14.jar:如果 pl/sql 返回一个 DATE 类型的变量并且我尝试将它放在 java.sql.Date 变量中,那么一切正常.示例:

ojdbc14.jar: if pl/sql returns a variable of type DATE and I try to put that in a java.sql.Date variable then everything works fine. Example:

Date yearDate = (Date) map.get("exam_date");

ojdbc6.jar:如果 pl/sql 返回一个 DATE 类型的变量并且我尝试将其放入 java.sql.Date 变量中,那么我得到一个异常:

ojdbc6.jar: if pl/sql returns a variable of type DATE and I try to put that in a java.sql.Date variable then I get an exception:

java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.sql.Date

推荐答案

实际上,ojdbc14.jar 并没有真正说明驱动程序的真实版本(请参阅 JDBC 驱动程序下载),除了它早于 Oracle 11g.在这种情况下,您应该提供准确的版本.

Actually, ojdbc14.jar doesn't really say anything about the real version of the driver (see JDBC Driver Downloads), except that it predates Oracle 11g. In such situation, you should provide the exact version.

无论如何,我想你会在DATE 和 TIMESTAMP 是怎么回事? 简而言之,他们在 9.2 驱动程序中更改了行为,然后在 11.1 驱动程序中再次更改了行为.

Anyway, I think you'll find some explanation in What is going on with DATE and TIMESTAMP? In short, they changed the behavior in 9.2 drivers and then again in 11.1 drivers.

这可能可以解释您遇到的差异(我建议使用最新版本,即 11.2 驱动程序).

This might explain the differences you're experiencing (and I suggest using the most recent version i.e. the 11.2 drivers).

这篇关于ojdbc14.jar 与 ojdbc6.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆