Get 0x81 varchar from jdbc

Copper Contributor

For sql server 2012 table with VARCHAR column, it contains 0x81 character. When using Java getString to pull the column, efbfbd (Replacement Character in UTF-8) is obtained. This seems due to that 0x81 is unused in Windows-1252 (, so it can not be converted to utf-8.

Two questions:
1. the column is used to store hash values, and it may contain some unused characters. What is the best option to store the values? like varbinary or nvarchar?
2. for jdbc connection, is it possible to set session with specific characterset?
for example, for mysql jdbc connection, "characterEncoding=Cp1252" option may be used. Is there similar way for sql server?

0 Replies