之前没怎么注意,SQLServer的Date类型,增删改没错,显示总是差两天.今天有人问才发现,惭愧.原来微软也有坑.

问题如下:

Result of JDBC query of date type column decrements days by 2

解决方案在MSDN的blog 传送门

Dear SQL Server developers and users:

Thank you for your ongoing support of the Microsoft JDBC Driver for SQL Server. Some of you reported problems with dates when using JRE 1.7.

The Microsoft JDBC Driver for SQL Server currently supports JRE 1.5 & JRE 1.6, however we have made modifications to return correct date values regardless of the JRE version. This modification is available in the production version of the Microsoft JDBC Driver 4.0 for SQL Server. The Microsoft JDBC Driver 4.0 for SQL Server is supported on JRE 1.5 and JRE 1.6, and support for JRE 1.7 is on our roadmap. In addition, the driver modification is also available for SQL Server 2000 customers as a hotfix in the 3.0 version of our driver. Please review the hotfix article to determine if the fix is applicable to you and if so, click the link to download the hotfix (applicable for all platforms).

As always we are interested in your feedback. You may report bugs and issues via our forums. If you encounter Java bugs you may report those to Java.

Thank you, Shamitha Reddy Program Manager Microsoft JDBC Driver for SQL Server

最新版JDBC下载地址:传送门

(完)

文章部分内容参考自:30岁