How To Map SQL DATE To java.sql.Date With 11g JDBC Driver ?
(Doc ID 470616.1)
Last updated on FEBRUARY 20, 2021
Applies to:JDBC - Version 22.214.171.124 and later
Information in this document applies to any platform.
Checked for relevance on 26-Mar-2013
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.
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