[freetds] Problems with large image transfers.

Lowden, James K LowdenJK at bernstein.com
Tue Sep 21 11:22:23 EDT 2004

-----Original Message-----
From: David Lambert
Sent: Monday, September 20, 2004 10:48 PM

I am having problems using freebcp when transferring large images. If I 
use character format the program exits with a segmentation fault. Using 
the following format statement, I get:

Msg 20049, Level 4
Data-conversion resulted in overflow.

The format file is:

1 SYBIMAGE 0 100000    "\t"    5    snap_data

Using gdb on freebcp. The dbconvert routine is entered as follows:

dbconvert (dbproc=0x9c881e8, srctype=34, src=0x9cbe698 "ÿØÿà", srclen=4096,
  desttype=34, dest=0x9caa998 "", destlen=255) at dblib.c:1673

This seems to indicate that the program thinks that the destination 
length  (255?) is shorter than the source length (4096).

Can you really use tab-delimited image data?  The image is guaranteed never to include 0x9?  

Assuming that's OK, the only way I can see that the destlen would be 255 is if the server says so.  If the file data are longer than 4096, there's a "special hack" in _bcp_read_hostfile that sets the destlen to the larger size. Else the server's column size is used.  Since you're looking at things with gdb already, trace through _bcp_read_hostfile to see for yourself.  ;-)

Things to double check:

1.  The CREATE statement for the table.  
2.  The TDS protocol version.  
3.  The version of FreeTDS.  

Note that dbconvert() is converting type 34 to 34 i.e., no conversion.  The "Data-conversion resulted in overflow" message comes straight from dbconvert() when it can't copy the source to the destination because the destlen is too small.  

BTW, freebcp should *never* segfault, so you found a bug.  A backtrace would be very helpful.  

There's more we can do, but let's get our ducks in a row first and see where we are.  



The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.
If you, as the intended recipient of this message, the purpose of which is to inform and update our clients, prospects and consultants of developments relating to our services and products, would not like to receive further e-mail correspondence from the sender, please "reply" to the sender indicating your wishes.  In the U.S.: 1345 Avenue of the Americas, New York, NY 10105.

More information about the FreeTDS mailing list