freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
[freetds] What SQL type for SQLBindParameter for NVARCHAR(MAX)/NTEXT when using UTF-8 locale?
- From: Sebastien FLAESCH <sf AT 4js.com>
- To: freetds AT lists.ibiblio.org
- Subject: [freetds] What SQL type for SQLBindParameter for NVARCHAR(MAX)/NTEXT when using UTF-8 locale?
- Date: Thu, 18 Oct 2012 10:27:34 +0200
Hello,
I am using a UTF-8 encoding in my Linux FreeTDS client program,
and want to insert LOB data into NVARCHAR(MAX)/NTEXT columns.
For now, I bind the SQL Parameter with:
ctype = SQL_C_CHAR;
sqltype = SQL_LONGVARCHAR;
precision = 0x10000000;
This works find as long as the data is ASCII (and probably also
ISO-885901), but when using UTF-8 sequences, I get this error:
SQL State: HY000
SQL code : 2402
[FreeTDS][SQL Server]Error converting characters into server's character set.
Some character(s) could not be converted
I guess this is expected, because I use SQL_LONGVARCHAR...
For NCHAR/NVARCHAR types, I use SQL_WCHAR / SQL_WVARCHAR SQL types
to bind my UTF-8 buffers, and this works fine.
But for large objects, what SQL type should I use?
I tried with SQL_WVARCHAR and a large size, without success:
[FreeTDS][SQL Server]Invalid string or buffer length
How to specify the precision for a CLOB?
As a comparison, with Easysoft SQL Server ODBC driver, you can bind
UTF-8 buffers with:
ctype = SQL_C_CHAR;
sqltype = SQL_WVARCHAR;
precision = SQL_SS_LENGTH_UNLIMITED;
Thanks for reading, please let me know what I should use!
Seb
-
[freetds] What SQL type for SQLBindParameter for NVARCHAR(MAX)/NTEXT when using UTF-8 locale?,
Sebastien FLAESCH, 10/18/2012
-
Re: [freetds] What SQL type for SQLBindParameter for NVARCHAR(MAX)/NTEXT when using UTF-8 locale?,
Frediano Ziglio, 10/18/2012
-
Re: [freetds] What SQL type for SQLBindParameter for NVARCHAR(MAX)/NTEXT when using UTF-8 locale?,
Sebastien FLAESCH, 10/19/2012
- Re: [freetds] What SQL type for SQLBindParameter for NVARCHAR(MAX)/NTEXT when using UTF-8 locale?, Frediano Ziglio, 10/23/2012
-
Re: [freetds] What SQL type for SQLBindParameter for NVARCHAR(MAX)/NTEXT when using UTF-8 locale?,
Sebastien FLAESCH, 10/19/2012
-
Re: [freetds] What SQL type for SQLBindParameter for NVARCHAR(MAX)/NTEXT when using UTF-8 locale?,
Frediano Ziglio, 10/18/2012
Archive powered by MHonArc 2.6.24.