My Oracle Support Banner

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 11.1.0.6 and later
Information in this document applies to any platform.
Checked for relevance on 26-Mar-2013

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


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.