Solved

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

Posted on 2003-11-25
17
1,812 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
  • 8
  • 7
  • 2
17 Comments
 
LVL 29

Expert Comment

by:leonstryker
Comment Utility
Can you switch to ADO and use the Stream object?

Leon
0
 

Author Comment

by:Konamiman
Comment Utility
> 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
Comment Utility
Too bad. :(

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

Leon
0
 
LVL 8

Expert Comment

by:MYLim
Comment Utility
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
Comment Utility
>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
Comment Utility
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
Comment Utility
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
Comment Utility
> 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 8

Accepted Solution

by:
MYLim earned 315 total points
Comment Utility
0
 
LVL 8

Expert Comment

by:MYLim
Comment Utility
0
 

Author Comment

by:Konamiman
Comment Utility
> 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
Comment Utility
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
Comment Utility
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
Comment Utility
just download project (*.zip) from the link i post...You can try after edit some code.
0
 

Author Comment

by:Konamiman
Comment Utility
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
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now