[freetds] freeTDS 0.64 driver errors from darwin client to SQL Server 2005

Nick Davis nick.davis at vidoop.com
Thu Dec 20 11:47:23 EST 2007


Hello,

(Apologies in advance for the long email) I've built freeTDS 0.64 on 
Darwin/Mac OS X (10.4.9) and am trying to connect to a SQL Server 2005 
database using the libtdsodbc.so driver.  I've written a program that 
runs a series of CREATE TABLE statements to initialize the schema of the 
database.  The login process goes through successfully, but when 
processing my SQL I always receive the following errors:

Database Exception: Error in SQL statement: CREATE TABLE version (
  major int,
  minor int,
  release int,
  iteration int);
Error code: 1
Error message: 75:S1010:[iODBC][Driver Manager]Function sequence error
Database Exception: Error in SQL statement: CREATE TABLE log_ug (
  id1 varchar(50),
  id2 varchar(30),
  timestamp bigint,
  error_code integer,
  addr varchar(30));
Error code: 1
Error message: 75:S1010:[iODBC][Driver Manager]Function sequence error

I've researched this error message fairly extensively and this *seems* 
to be a character encoding issue.  I've captured traces from the iODBC 
driver and freeTDS.  In the freeTDS logs these lines:
iconv.c:361:iconv to convert client-side data to the "UTF-8" character set
iconv.c:514:tds_iconv_info_init: converting "UTF-8"->"UCS-2LE"
iconv.c:514:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
.........
iconv.c:514:tds_iconv_info_init: converting "UTF-8"->"CP1252"

indicate iconv is converting from UTF-8 to the database's encoding of 
Windows codepage 1252.  This occurs after I added an entry to my 
freetds.conf file as follows:

[test]
    host = 192.168.20.63
    port = 1433
    tds version = 8.0
    client charset = UTF-8

Previously I was using DSN-less (i.e. not referencing odbc.ini or 
freetds.conf) mode and specifying the IP address in the connection 
string.  When doing that, the conversion lines are:
iconv.c:361:iconv to convert client-side data to the "ISO-8859-1" 
character set
iconv.c:514:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
iconv.c:514:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
.........
iconv.c:514:tds_iconv_info_init: converting "ISO-8859-1"->"CP1252"

I'm not sure which encoding I should be using on the client, as both 
ISO-8859-1 and UTF-8 produce the error.

Here is my odbcinst.ini file:

[ODBC Drivers]
SQL Server = Installed

[SQL Server]
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/local/lib/libtdsodbc.so

Any ideas or suggestions of where to look would be much appreciated.

Thanks,

Nick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3253 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20071220/cee45e7a/attachment.bin 


More information about the FreeTDS mailing list