JDBC Returns Wrong Value for Years in the BC Era (Negative Years)

(Doc ID 1403794.1)

Last updated on MARCH 08, 2017

Applies to:

JDBC - Version 10.1.0.2 to 11.2.0.3.0 [Release 10.1 to 11.2]
Information in this document applies to any platform.

Symptoms

The JDBC driver returns the wrong year for dates or timestamps in the database that are in the BC era (in other words, a "negative" year).

Specifically, the driver returns the value "year minus 1" rather than the correct value "year".  For example, for year -1, the driver returns year -2; for year -100, it returns the year -101.

The same values in SQL*Plus are returned correctly.

The problem occurs when retrieving data using getDate() or getTimestamp().  It also reproduces if using TIMESTAMPTZ.stringValue() or TIMESTAMPLTZ.stringValue() .

The problem does NOT reproduce if using getString() .

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms