My Oracle Support Banner

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

Last updated on OCTOBER 17, 2022

Applies to:

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


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() .




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

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