Microsoft KB Archive/910369

= FIX: Some parameter values that are sent in a non-Unicode format may be incorrectly converted when you use the SQL Server 2000 Driver for JDBC =

Article ID: 910369

Article Last Modified on 2/15/2006

-

APPLIES TO


 * Microsoft SQL Server 2000 Driver for JDBC

-





SYMPTOMS
When you use the Microsoft SQL Server 2000 Driver for JDBC to send parameter data in a non-Unicode format, some parameter values may be incorrectly converted.

Note This problem occurs when the following conditions are true:
 * You use data in the range of 0x80 to 0x9F that is encoded by using Latin 1 standard characters.
 * The SendStringParametersAsUnicode connection string property is set to False.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft SQL Server 2000 Driver for JDBC service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English 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 tool in Control Panel.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
For more information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

Code to reproduce the problem
import java.sql.*;

/*Run the following commands in SQL Query Analyzer before you try the code sample.*/ /*use Northwind GO create table texttable( text varchar(20)) GO */

public class Params {   static Connection con;

public static void main(String[] args) throws SQLException {       try {           Class.forName(&quot;com.microsoft.jdbc.sqlserver.SQLServerDriver&quot;);

Connection con = DriverManager.getConnection(&quot;jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Northwind;SendStringParametersAsUnicode=false;selectmethod=direct&quot;,&quot;uid&quot;,&quot;pwd&quot;);

String text = &quot;abcd\u20ac\u201a\u0192\u201e&quot;;

System.out.println(&quot;Inserting:&quot;); for (int i=0; i<text.length; i++) {               int ivalue = text.charAt(i); String output = Integer.toHexString( (int) ivalue) ; System.out.print(output + &quot; &quot;); }           System.out.println; PreparedStatement pstmt = null; String sqlQuery = &quot;delete from texttable;insert into texttable (text) values (?)&quot;;

pstmt = con.prepareStatement(sqlQuery); pstmt.setString(1, text); pstmt.execute;

pstmt.close; pstmt=null;

Statement st = con.createStatement; ResultSet rs=st.executeQuery(&quot;Select text from texttable&quot;); System.out.println(&quot;Obtained:&quot;); while (rs.next) {               String s = rs.getString(1); for (int i=0; i<s.length; i++) {                   int ivalue = s.charAt(i); String output =  Integer.toHexString( (int) ivalue) ; System.out.print(output + &quot; &quot;); }               System.out.println; }

con.close; con=null; }       catch(Exception e)        { System.out.println(e); e.printStackTrace; }   } }

Output before fix
Inserting:

61 62 63 64 20ac 201a 192 201e

Obtained:

61 62 63 64 ac 1a 3f 1e

Output after fix
Inserting:

61 62 63 64 20ac 201a 192 201e

Obtained:

61 62 63 64 20ac 201a 192 201e

Keywords: kbtshoot kbbug kbfix kbpubtypekc kbmsccsearch KB910369

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.