Sybase error "An illegal length was received" when retrieving BLOB data with RDO

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!
KonamimanAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leonstrykerCommented:
Can you switch to ADO and use the Stream object?

Leon
0
KonamimanAuthor Commented:
> Can you switch to ADO and use the Stream object?

No. In the mid/long term, the enterprise where I work is planning to jump to VB .NET and then use ADO .NET; but in the mean time, I am obligated to stick to RDO since all the existing VB5 code uses this.
0
leonstrykerCommented:
Too bad. :(

Sorry can't help with RDO.  (Forgot most of what little I knew about it)

Leon
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

MYLimCommented:
ro_donn@hotmail.com wrote...
 > This is the exact error message when I tried to retrieve records from one of
 > the tables in my database using PB 6.5
 >
 > ct_fetch(): network packet layer: external error: There is a protocol packet
 > error. An illegal length was received"
 >
 >
 > But when I tried to retrieve it in SQL Advantage, I received the message
 > below.
 > Failure has occurred in CT-Library call. Connection is no longer usable and
 > will be automatically dropped.
 > Client Message: Layer 5, Origin 1, Severity 5, Number 18
 >
 > I suspect that some of the records are corrupted.it only retrieves 1945
 > records. The total number of records in that particular table is around 30,
 > 940. I knew this because, the select count(*) command does not fail.
 >
 > I hope the Sybase Team could help in me in this matter.
 >
 > Comments: This newsgroup has been very helpful to me! More power!

I think you'll need to run your DBCC validations against the table/database to know for
sure if you have a corruption problem.
--
Jim Egan [TeamSybase]
Senior Consultant
Sybase Professional Services

Sybase TechWave 2001 http://www.sybase.com/events/techwave2001
August 12th - 16th, San Diego
0
KonamimanAuthor Commented:
>I think you'll need to run your DBCC validations against the table/database to know for
>sure if you have a corruption problem.

Ok, I just proposed this one to my boss; but he says that he already tried this and did not found any corruption problem.
0
MYLimCommented:
pls try this in command Prompt (remember change Ip to your server IP and Ctrl + C to stop) : several minute observation needed...
ping -t 199.0.0.199

for good network connection should like below:
C:\>ping 199.2.4.1 -t

Pinging 199.2.4.1 with 32 bytes of data:

Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128
Reply from 199.2.4.1: bytes=32 time<10ms TTL=128

Ping statistics for 199.2.4.1:
    Packets: Sent = 17, Received = 17, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum =  0ms, Average =  0ms
Control-C
^C
C:\>

0
MYLimCommented:
i guess this is merely network problem.
see the link below (Open Client Error Messages)

http://sybooks.sybase.com/onlinebooks/group-cn/cng1250e/ocerrors/@Generic__BookTextView/10350

Find this string "An illegal length was received" in the page i mention.
0
KonamimanAuthor Commented:
> pls try this in command Prompt (remember change Ip to your server IP and Ctrl + C to stop) : > several minute observation needed...
> ping -t 199.0.0.199

Ok, tried for about 40 minutes. 2408 packets were sent and no one was lost.

> i guess this is merely network problem.

But this is strange. We make an intensive use of this DB server and errors appears only when trying to execute the command in question.
0
MYLimCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KonamimanAuthor Commented:
> lastly,pls try your program using ADO.just a try...

Sorry, but this is not possible. It is not that I don't want to use ADO... it is just that I can't! :-)
0
MYLimCommented:
no no no..... i means try using Ado to find out the problem source.Not comment you use Ado.Don worry :) after we know problem then we can fix it base on RDO code.
0
KonamimanAuthor Commented:
Ok, but I have never used ADO before so I must first learn how it works... I'll try when I have some free time.
0
MYLimCommented:
just download project (*.zip) from the link i post...You can try after edit some code.
0
KonamimanAuthor Commented:
It seems that my boss has forgot (or solved by himself without noticing me) about this problem and I now have to use my time with another jobs... so I'll accept your links to ADO code samples as an answer, since for sure they are useful and maybe I can use them in the future.

Anyway I hope we can switch to VB.NET soon, I'm really tired of VB5...
0
MYLimCommented:
as i know,VB.Net are OOP base Programming language.I will support you to use it.
Microsoft have upgrade a lot of control inside .net.EX: datagrid.it can add checkbox in datagrid but in VB6.0 we can only use ListView control to do that...
0
KonamimanAuthor Commented:
Yeah, I know, recently I have read a whole book about VB.NET and it looks VERY nice (the DataSet object, for example, is like a dream). Now it is difficult for me to continue with VB5...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.