Question
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.
Env:-
Oracle 11g, JDK 1.6, iBatis, PL/SQL
Scenario:-
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 annualDate = (Date) map.get("exam_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
Answer
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.
Anyway, I think you'll find some explanation in [What is going on with DATE and TIMESTAMP?](http://www.oracle.com/technetwork/database/enterprise- edition/jdbc-faq-090281.html#08_01) In short, they changed the behavior in 9.2 drivers and then again in 11.1 drivers.
This might explain the differences you're experiencing (and I suggest using the most recent version i.e. the 11.2 drivers).