Reputation: 779
I need to be able to save birth date which in the app is represented as GregorianCalendar to Oracle DB as date.
That should be simple right? Wrong. Here is my problem.
When I save birth date I do it as following
CallableStatement cstmtData= connection.prepareCall(sql);
stmtUpdateRec.setDate(1,birthDate==null?null:new java.sql.Date(birthDate.getTime().getTime()));
Works perfectly well for dates after Jan 1, 1950. However any dates prior to Jan 1, 1950 are converted to the 21 century i.e. Jan 2, 1917 is saved to the database as Jan 2, 2017.
Any ideas why does this happen?
Upvotes: 1
Views: 560
Reputation: 779
Thanks for letting me bounce my thoughts off of you. I figured it out. Roey Golzarpoor you were right as the issue was with one of the SQL statements inside of my proc.
I don't know why but for whatever reason I have uppercased DATE field. I used actual upper()
function on date field. That caused this absolutely wacky behaviour.
Upvotes: 2