[freetds] unicode support (chinese)

Van Shuka vanshuka at gmail.com
Sun Aug 3 10:09:15 EDT 2008


Hello,

I'm working on CentOS 5.2
and connecting(sadly)  to MS SQL Server 2005 with unixODBC+FreeTDS 0.82

The data i need to insert/select is unicode chinese characters (like 0x4e2d)
into nvarchar(50) field.


SQLINTEGER chineseCharInd;
SQLWCHAR chineseChar[3]={0};

chineseChar[0] = 0x4e2d;
chineseChar[1] = 0x5152;
chineseChar[2] = 0;

However binding this parameter with:

sqlError = SQLBindParameter(sqlStmt, 1, SQL_PARAM_INPUT,
        SQL_C_WCHAR, SQL_WVARCHAR, 50, 0,
        &chineseChar, sizeof(chineseChar), &chineseCharInd);

I'm getting the error state=HY004, [FreeTDS][SQL Server]Invalid data type


And when I'm trying to select data using

sqlError =
SQLBindCol(sqlSelectStmt,1,SQL_C_WCHAR,sqlName,sizeof(sqlName),&ValNameInd);

I'm getting the error:
state=HY003 [FreeTDS][SQL Server]Program type out of range.

(The same code runs on XP correctly).

Is there anything I'm missing?
Appreciate your help.

Van



More information about the FreeTDS mailing list