?
Solved

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

Posted on 2003-11-25
17
Medium Priority
?
1,985 Views
Last Modified: 2013-12-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!
0
Comment
Question by:Konamiman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
  • 2
17 Comments
 
LVL 29

Expert Comment

by:leonstryker
ID: 9817930
Can you switch to ADO and use the Stream object?

Leon
0
 

Author Comment

by:Konamiman
ID: 9818182
> 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
 
LVL 29

Expert Comment

by:leonstryker
ID: 9818193
Too bad. :(

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

Leon
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:MYLim
ID: 9830428
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
 

Author Comment

by:Konamiman
ID: 9835647
>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
 
LVL 8

Expert Comment

by:MYLim
ID: 9835991
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
 
LVL 8

Expert Comment

by:MYLim
ID: 9836528
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
 

Author Comment

by:Konamiman
ID: 9836948
> 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
 
LVL 8

Accepted Solution

by:
MYLim earned 945 total points
ID: 9840712
0
 

Author Comment

by:Konamiman
ID: 9850547
> 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
 
LVL 8

Expert Comment

by:MYLim
ID: 9854862
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
 

Author Comment

by:Konamiman
ID: 9858910
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
 
LVL 8

Expert Comment

by:MYLim
ID: 9863337
just download project (*.zip) from the link i post...You can try after edit some code.
0
 

Author Comment

by:Konamiman
ID: 9910503
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
 
LVL 8

Expert Comment

by:MYLim
ID: 9910852
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
 

Author Comment

by:Konamiman
ID: 9910991
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question