Oracle JDBC API changes: things that make me sigh
For reasons that escape me at the moment (something about support from Oracle, I think), we are having to upgrade the Oracle JDBC driver from 10.2.0.4 to 18.104.22.168. Ideally, this would be a simple, transparent change. But it isn't.
A co-worker quickly found an issue with the driver's handling of java.sql.Date and java.sql.Timestamp. Specifically, the previous driver would map SQL DATE columns to java.sql.Date, while the current driver maps SQL DATE columns to java.sql.Timestamp. The details are described by the Oracle JDBC faq, What is going on with DATE and TIMESTAMP? (Note: that entry describes the previous, 10.2.0.4 behavior as the "problem".)
The bottom line is that if you use
resultSet.getObject(i) then for a DATE column you will now get a java.sql.Timestamp object where you would previously get a java.sql.Date object. Also, if you use code like
You will also get a java.sql.Timestamp instead of a java.sql.date, since the java.sql.Types mapping has changed as well.
Now, I don't know whether or not this is the Right Thing To Do. I don't actually care either way. But the change, even to fix a problem, just makes me want to sob quietly.
And the Java standard library's API is just as wacky as ever.