FIX: SQL Server JDBC Driver 3.0 returns incorrect date values when used with JRE 1.7 by a Java application

Article translations Article translations
Article ID: 2652061 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

Consider the following scenario:
  • You have a Java application that uses Microsoft SQL Server JDBC Driver version 3.0 and Java Runtime Environment version 1.7 (JRE 1.7) to connect to a SQL Server database.
  • The application uses any of the following functions to obtain a date from the database:
    • getDate()
    • getTimeStamp()
    • getDateTimeOffset()
  • The data type in the SQL Server database is DATE, DATETIME2, or DATETIMEOFFSET.
In this scenario, the function returns an incorrect date value.

Notes
  • This issue occurs only when the date value that is returned by the function is more recent than the year 1582 in the Gregorian calendar.
  • This issue does not occur if the application uses one of the following combinations of components:
    • Microsoft SQL Server JDBC Driver version 3.0 and JRE 1.5 or JRE 1.6
    • Microsoft SQL Server JDBC Driver version 2.0 and JRE 1.7

CAUSE

The behavior of the functions that are described in the "Symptoms" section depends on the Java calendar APIs. Because of changes in the behavior of these APIs, Microsoft SQL Server JDBC Driver version 3.0 returns incorrect values.

RESOLUTION

Microsoft SQL Server JDBC Driver version 3.0 was modified so that the functions that are described in the "Symptoms" section return correct values regardless of the JRE version. Microsoft JDBC Driver 4.0 for SQL Server will also contain this modification.

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing the problem described in this article. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website:
http://support.microsoft.com/contactus/?ws=support
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Installation information

To install this hotfix, follow these steps.

Windows
  1. Read the license.txt file for this hotfix.
  2. To accept this license agreement, download and use Microsoft SQL Server JDBC Driver version 3.0.
  3. Download and save the sqljdbc_<version>_enu.exe file in a temporary directory.
  4. Run the sqljdbc_<version>_enu.exe file.
  5. When you are prompted, enter an installation directory. We recommend that you unpack the compressed (.zip) files by using the following default directory:
    %ProgramFiles%\Microsoft SQLServer JDBC Driver 3.0
  6. After the package is unpacked, open the JDBC Help system by opening InstallationDirectory\Microsoft SQL Server JDBC Driver 3.0 \sqljdbc_<version>\<language>\help\default.htm. JDBC Help is displayed in the web browser.

UNIX
  1. Read the license.txt file for this hotfix.
  2. To accept this license agreement, download and use Microsoft SQL Server JDBC Driver version 3.0.
  3. Download and save the sqljdbc_<version>_enu.tar.gz file to a temporary directory.
  4. To unpack the compressed .gz file, locate the directory where you saved the file, and then type the following:
    gzip -d sqljdbc_<version>_enu.tar.gz
  5. To unpack the .tar file, move it to the directory where you want to install the driver, and then type the following:
    tar -xf sqljdbc_<version>_enu.tar
  6. After the package is unpacked, open the JDBC Help system by opening InstallationDirectory\Microsoft SQL Server JDBC Driver 3.0 \sqljdbc_<version>\<language>\help\default.htm. JDBC Help is displayed in the web browser.


Hotfix replacement information

This hotfix includes all previous hotfixes for Microsoft SQL Server JDBC Driver version 3.0.

File information

The global version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Sqljdbc.jarNot Applicable 518,29408-Dec-201116:05 Not Applicable
Sqljdbc4.jarNot Applicable 537,56608-Dec-201116:05 Not Applicable
Xa_install.sqlNot Applicable 37,1208-Dec-201116:05 Not Applicable
Sqljdbc_xa.dll     3.0.1301.203253,74408-Dec-201116:05 IA-64
Sqljdbc_xa.dll     3.0.1301.203131,37608-Dec-201116:05 x64
Sqljdbc_xa.dll     3.0.1301.203102,19208-Dec-201116:05 x86
Sqljdbc_auth.dll 3.0.1301.203175,40808-Dec-201116:05 IA-64
Sqljdbc_auth.dll 3.0.1301.20387,34408-Dec-201116:05 x64
Sqljdbc_auth.dll 3.0.1301.20369,93608-Dec-201116:05 x86




STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Properties

Article ID: 2652061 - Last Review: January 12, 2012 - Revision: 4.0
APPLIES TO
  • Microsoft SQL Server Java Database Connectivity Driver 3.0
Keywords: 
kbqfe kbhotfixserver kbfix kbexpertiseadvanced kbsurveynew kbautohotfix KB2652061

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com