问题
I suddenly noticed that Oracle JDBC driver that I was using With Oracle 11g R2 was thinking that daylight savings time in US started after 2:59:59 am on March 13th this year. Actually, it started after 1:59:59 am. I did some additional testing and noticed that the buggy behavior of that driver did not depend on whether it talks to Oracle 11g R2 or Oracle 10g. Also, all available previous versions of that driver handle daylight savings time change correctly.
Is this a known bug? Is there a fix available for it?
回答1:
Our DBA did research and found that this is a known bug and that a patch is available for it. Thanks everyone who cared to look into this and rake your brain for answers!
EDIT 9/25/2013: At the time of writing (over 2 years ago) a patch for the Oracle JDBC driver 11.2.0.2.0 was available to the paying Oracle customers. I have not tested personally, but I believe that the issue is resolved in the current version of the Oracle JDBC driver 11.2.0.4 which is available from Oracle for a free download.
回答2:
Yes I agree that it is the driver. If your column is of type TIMESTAMP then Oracle will allow these invalid dates to get inserted into the DB then certain queries will throw
Error querying database. Cause: java.sql.SQLException: ORA-01878: specified field not found in datetime or interval
The error may involve defaultParameterMap
The error occurred while setting parameters
Cause: java.sql.SQLException: ORA-01878: specified field not found in datetime or interval
until the "bad" records are updated in the DB. This thread on stack overflow which was updated yesterday has the full detail. See the answer from Chris Williams
Oracle date compare broken because of DST
来源:https://stackoverflow.com/questions/6687454/was-daylight-savings-time-handling-broken-in-oracle-jdbc-driver-version-11-2-0-2