[freetds] "DB-lib error, no 20050, Attempt to convert data stopped by syntax error in source field" - FreeTDS trying to convert to SYBMONEY for some reason?

Frediano Ziglio freddy77 at gmail.com
Fri Aug 5 13:24:34 EDT 2016


2016-08-05 18:03 GMT+01:00 Karen Pease <Karen.Pease at isavia.is>:
> Hi, all. I'm trying to get a piece of software to work on 64 bit and as a consequence I can no longer use the "sybase-ocsd" package that we'd been using, since I can only locate it in 32 bit.  So I'm trying FreeTDS.  But I can't make heads or tails of the error I'm getting.
>
> In my code, I'm running:
>
>     dbcmd (ET_dbproc, " select distinct a.program_name, b.name ");
>     dbcmd (ET_dbproc, " from sysprocesses a, sysdatabases b");
>     dbcmd (ET_dbproc, " where a.dbid = b.dbid");
>     dbsqlexec (ET_dbproc);
>     SYDBRESULT (ET_dbproc);
>     dbbind (ET_dbproc, 1, NTBSTRINGBIND, (DBCHAR) 0, program);
>     dbbind (ET_dbproc, 2, NTBSTRINGBIND, (DBCHAR) 0, dname);
>     printf("%d\n", __LINE__);
>     dbnextrow(ET_dbproc);
>     printf("%d\n", __LINE__);
>     printf ("program %s, dname %s", program, dname);
>
> Program and dname are of course character arrays.  On the database end, a.program_name is a char(8) and name is sysname(30).
>
> From that, I see:
>
>     421
>     syeh: DB-lib error, no 20050, Attempt to convert data stopped by syntax error in source field
>              os error, Success
>     423
>     program , dname
>
>
> Dumping the debug output to a file, it ends like:
>
> -------
> token.c:564:processing result tokens.  marker is  d1(ROW)
> token.c:1951:tds_process_row(): reading column 0
> data.c:534:tds_get_data: type 47, varint size 1
> data.c:587:tds_get_data(): wire column size is 16
> token.c:1951:tds_process_row(): reading column 1
> data.c:534:tds_get_data: type 39, varint size 1
> data.c:587:tds_get_data(): wire column size is 6
> util.c:165:Changed query state from READING to PENDING
> buffering.h:305:buffer_transfer_bound_data(0x24c2670 4040 -1 0x24c2660 0)
> dblib.c:7210:copy_data_to_host_var(47 [SYBCHAR] len 16 => 60 [SYBMONEY] len 0)
> dblib.c:7364:copy_data_to_host_var(): tds_convert returned 8
> dblib.c:7210:copy_data_to_host_var(39 [SYBVARCHAR] len 6 => 60 [SYBMONEY] len 0)
> dblib.c:7364:copy_data_to_host_var(): tds_convert returned -3
> dblib.c:7925:dbperror(0x24c2660, 20050, 0)
> dblib.c:7993:dbperror: Calling dblib_err_handler with msgno = 20050; msg->msgtext = "Attempt to convert data stopped by syntax error in source field"
> dblib.c:4865:dbdead(0x24c2660) [alive]
> dblib.c:8015:dbperror: dblib_err_handler for msgno = 20050; msg->msgtext = "Attempt to convert data stopped by syntax error in source field" -- returns 2 (INT_CANCEL)
> dblib.c:2117:leaving dbnextrow() returning REG_ROW/MORE_ROWS
> -------
>
> Huh? SYBMONEY?  How did money come into the picture here?
>
> Lots more errors are coming up, but let's start at the beginning with this, because it's sure left me scratching my head...
>
> (Full disclosure: I'm a newbie at Sybase; my experience lies mainly with postgres. But the task at hand for me involves porting our app to 64 bit, so....)
>
>
>  - kv, Karen
>


Simple, you are using Sybase headers and linking with FreeTDS.
NTBSTRINGBIND is 13 under Sybase headers but 13 is MONEYBIND in
FreeTDS headers.
There is no ABI compatibility.

Frediano


More information about the FreeTDS mailing list