How To Map SQL DATE To java.sql.Date With 11g JDBC Driver ?
(Doc ID 470616.1)
Last updated on FEBRUARY 01, 2022
Applies to:
JDBC - Version 11.1.0.6 and laterInformation in this document applies to any platform.
Goal
By default, with the 11g Oracle JDBC driver, the oracle.sql.DATE is mapped to java.sql.TimeStamp class.
This is a change of behavior : with the 10g Oracle JDBC driver, the oracle.sql.DATE was mapped to java.sql.Date class.
This means with the 11g JDBC driver, when calling method getColumnType () method, it returns the TimeStamp type for a Date column type.
This can be verified by this sequence of code which shows how Oracle JDBC driver maps SQL Date and Timestamp types :
The 93 value corresponds to the TIMESTAMP constant defined in the java.sql.Types class. So, it shows
that 11g JDBC driver maps the Oracle SQL DATE to java.sql.Timestamp class.
The question is here to know how to enable the 10g JDBC driver behavior : to map Oracle SQL DATE to a java.sql.Date class.
Solution
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |
In this Document
Goal |
Solution |
References |