Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

We migrated from to ojdbc6-11.2.0.3.0 to ojdbc7-12.1.0.1 and observed a change in the ResultSet#getDate() semantics. Previously the java.sql.Date returned would be 'normalized' by having set the hours, minutes, seconds and milliseconds to zero according to the contract specified on java.sql.Date. With ojdbc7this is no longer the case and java.sql.Date has the hours, minutes, seconds and milliseconds set according to the value on the database.

I looked at the Javadoc of ResultSet#getDate() and it doesn't explicitly say which of the behaviors is the correct one. I would have assumed the old behavior was what the specification intended. Am I right? Have we encountered a driver bug?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
129 views
Welcome To Ask or Share your Answers For Others

1 Answer

This is clearly a bug as the documentation of the class java.sql.Date states

To conform with the definition of SQL DATE, the millisecond values wrapped by a java.sql.Date instance must be 'normalized' by setting the hours, minutes, seconds, and milliseconds to zero in the particular time zone with which the instance is associated.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...