Sybase error "An illegal length was received" when retrieving BLOB data with RDO
Posted on 2003-11-25
Hi all. I have a problem related to BLOB data retrieval from Visual Basic.
I have a table stored in the database "posicion" which has a field of image type named "textoimage". This table contains one record in which the textimage field contains about 980000 bytes of binary data. I'm trying to retrieve this data through RDO using the following operations:
'rdoCn is an opened rdoConnection, rdoRs is a rdoResultSet
rdoCn.Execute "set textsize 1000000", rdExecDirect
Set rdoRs = rdoCn.OpenResultset("select recno,textoimage from posicion where recno=35500000000001848", rdOpenDynamic, rdConcurValues) 'recno is numeric
'... (GetChunk and the like)
The problem is that the select statement is intermittently throwing the following ODBC error:
S1000: ct_cancel(): There is a protocol packet error. An illegal length was received.
Sometimes the select statement works fine, and sometimes it throws the error. Usually, the first time I execute the query it works and when I repeat it then it fails; but it also happens that it works two or three times consecutively, or that it fails at the first execution. I don't know what to do since the only way I found to avoid the error is to specify a smaller number in the "set textsize" statement, but then I can't retrieve the complete data stored on the field.
Here is some more background info:
I'm using Win2K Pro SP4 and Visual Basic 5 with RDO 2.0.
Database server is a Sybase SQL Server 11 running on SCO UNIX. "select @@version" returns the following string:
SQL Server/11.0.3/P/SCO/SCO_SV r3.2v5.0.2/2/OPT/Fri Jul 18 19:10:23 PDT 1997
ODBC driver for Sybase is SYSYBNT.DLL 3.00.00.00, with date 10/3/1997.
Thank you for your help!