Java JDBC: dates consistently two days off

前端 未结 9 1838
孤城傲影
孤城傲影 2020-12-14 16:53

I am using Java JDBC to write a date to SQL server 2008 and then read it back.
The date that is read back is consistently two days earlier than the date that was actuall

9条回答
  •  隐瞒了意图╮
    2020-12-14 17:08

    Faulty JDBC Driver

    It turns out the problem was the MS JDBC driver. I tried every possible combination of date types and date conversions and nothing worked. After a great deal of searching (should have done that first!) I saw a comment on an older SO entry that implied the problem was the version 3 JDBC driver from Microsoft. I got the latest driver, version 4.something, and the problem went away.

    Thanks to all that tried to help. Special thanks to you Mike for taking the time to post a solution.

    -=beeky

提交回复
热议问题