Tuesday, September 04, 2007 10:51 PMConfiguration: MS SQL server 2005 SP2, and MS jdbc driver version: 1.1
The sendStringParameterAsUnicode has been set to false for performance reasons. However, when inserting unicode data, we would like to override the setting and send the data encoded in unicode, instead of defaulting the whole app to unicode=true and take a performance hit.
Any suggestions? We have tried the cast(? as nvarchar) function, but that did not help.
String text = "\u0143\u0144";
insert into unitable (_ntext) values (?)
Inserting into databse:
143 144 (printed hex values)
Read from database:
3f 3f (printed hex values)
Wednesday, September 05, 2007 5:35 PMModerator
Unicode is the native string representation for communication with SQL Server, if you are converting to MBCS, then you are doing 2 converts for every string. I suggest that if you are concerned with performance, use all Unicode instead of all MBCS.
Hope that helps,
Friday, September 07, 2007 5:03 AMModerator
Sample code will be great in helping to answering this question. I am interested in what API calls are being made to insert and retrieve the data (stmt.execute(), pstmt.setString(), rs.getString(), rs.getCharacterStream(), etc).
Additionally, the following diagnostic information may help:
SQL Server Collation.
SQL Server Machine Language.
Client machine Language.
I'll assume the client and server machines are distinct. Therefore, let's clarify where the data is being improperly converted. After insertion, is the data accurate on the server?
Friday, September 07, 2007 8:27 PMDetails at:
Saturday, September 08, 2007 5:46 AMModeratorI am glad to see this solved on the newsgroups.