The getBytes function incorrectly converts the raw bytes in the varchar data type column to the lower byte of the Unicode representation in the SQL Server 2000 Driver for JDBC (904790)
The information in this article applies to:
- Microsoft SQL Server 2000 Driver for JDBC
SYMPTOMSIn Microsoft SQL Server 2000, an array of raw bytes is stored in a varchar data type column. When you use the SELECT statement to query a table, the Microsoft SQL Server 2000 Driver for JDBC processes the request to return a byte array. In the SQL Server 2000 Driver for JDBC, the getBytes function incorrectly converts the raw bytes in the varchar data type column to the lower byte of the Unicode representation.CAUSEThis problem occurs because the hexadecimal code for the data that is read back from the table becomes 0x1A, 0xCC. The hexadecimal code 0x82 in the 1252 (Latin I) code page corresponds to 201A in Unicode. The hexadecimal code 0x8f does not exist in the 1252 (Latin I) code page. Therefore, the hexadecimal code 0x8f is converted to CCCC in Unicode. Additionally, the SQL Server 2000 Driver for JDBC retrieves the lower byte of each Unicode character and puts the bytes together in the byte array.WORKAROUNDTo work around this problem, explicitly cast the column data as the varbinary data type. Because the SQL Server 2000 Driver for JDBC knows that the column data is the varbinary data type, the SQL Server 2000 Driver for JDBC does not perform the conversion.REFERENCES
For more information about JDBC, click the following article number to view the article in the Microsoft Knowledge Base:
313100
How to get started with Microsoft JDBC
Modification Type: | Major | Last Reviewed: | 8/19/2005 |
---|
Keywords: | kbtshoot kbprb KB904790 kbAudITPRO kbAudDeveloper |
---|
|