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:
日期年度日=(日期)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).