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
The "14" and "6" in those driver names refer to the JVM they were written for. If you're still using JDK 1.4 I'd say you have a serious problem and need to upgrade. JDK 1.4 is long past its useful support life. It didn't even have generics! JDK 6 u21 is the current production standard from Oracle/Sun. I'd recommend switching to it if you haven't already.
Also, from ojdbc14 to ojdbc6, several types (e.g., OracleResultSet
, OracleStatement
) moved from package oracle.jdbc.driver
to oracle.jdbc
.
I have same problem!
Found following in oracle site link text
As mentioned above, the 11.1 drivers by default convert SQL DATE to Timestamp when reading from the database. This always was the right thing to do and the change in 9i was a mistake. The 11.1 drivers have reverted to the correct behavior. Even if you didn't set V8Compatible in your application you shouldn't see any difference in behavior in most cases. You may notice a difference if you use getObject to read a DATE column. The result will be a Timestamp rather than a Date. Since Timestamp is a subclass of Date this generally isn't a problem. Where you might notice a difference is if you relied on the conversion from DATE to Date to truncate the time component or if you do toString on the value. Otherwise the change should be transparent.
If for some reason your app is very sensitive to this change and you simply must have the 9i-10g behavior, there is a connection property you can set. Set mapDateToTimestamp to false and the driver will revert to the default 9i-10g behavior and map DATE to Date.
Source: Stackoverflow.com