Board index » delphi » Invalid Blob handle in record buffer?

Invalid Blob handle in record buffer?

Hello All,

I'm suddenly getting this error and can't get rid of it.  Per a previous
suggestion I changed the BLOBS TO CACHE setting for my ODBC driver
(which, by the description, should have fixed it) from 64 to 10,000 but
it had no effect.  (There are a total of 2,000 blob fields in the "BAD"
query) The BDE Help states:

BLOBS TO CACHE:
Determines how many BLOBs will be cached on the client. Applications
that deal with fetching dead BLOBs using dead table opens or queries can
set a limit on the number of BLOBs to cache depending on the resource
available on the client.

Setting a value of 100 means the application can work with a maximum of
100 BLOB records cached. Fetching more than 100, then scrolling back 100
records results in an "Invalid Blob handle in record buffer" error
message. This parameter does not apply to live table opens. Default
Value: 64, Range : >64 and < 65536.

I see this as being a HUGE limitation of the BDE (and cached updates), I
guess I don't fully understand why Delphi doesn't just handle this error
internally.  I'm encountering this error when I do a "Last/First"
combination on the dataset.  I don't get the error if the Blob Fields in
the First record are NULL.  

My Questions:

Are there any other reasons that this error message is generated?  What
EXACTLY does it mean?  

Can I clear the "BLOB CACHE" somehow when I may be reverse scrolling a
large number of records to avoid this?

Thanks for any insight. - Mike
--
==========================================
=  Michael D. Mount                      =
=  National Field Representatives, Inc.  =
=  Claremont, New Hampshire              =
==========================================

 

Re:Invalid Blob handle in record buffer?


Quote
Michael Mount wrote:
> My Questions:

> Are there any other reasons that this error message is generated?
> What
> EXACTLY does it mean?

> Can I clear the "BLOB CACHE" somehow when I may be reverse scrolling a
> large number of records to avoid this?

As an update, I've gone through and eliminated CachedUpdates from my
application (they're causing way more problems than they're solving).
I've changed the query methodology to always use a database view in SQL
Anywhere and set the TQuery RequestLive properties to True (where
required).  The error ("Invalid BLOB Handle in Record Buffer.") has been
eliminated from the "view" that was originally giving me problems.
Unfortunately, it has reappeared in a "view" that was previously working
even though I am now getting a Live Result set.  I say to myself, "Okay,
to heck with it, I'll just put an error trap around the Query.First
command, close and reopen the query if I get the error."  I did this
like so:

try
  Query.First;
except
  on E: EDBEngineError do
    if E.Message = 'Invalid BLOB Handle in Record Buffer.' then
    begin
      Query.Active := False;
      Query.Active := True;
    end
    else
      raise;
end;

This doesn't work.  I get into the exception block (if statement) and
then jump right back out of it without executing the "if" or the
"else".  Any idea's???

Thanks in advance.  Mike

--
==========================================
=  Michael D. Mount                      =
=  National Field Representatives, Inc.  =
=  Claremont, New Hampshire              =
==========================================

Re:Invalid Blob handle in record buffer?


Okay, it gets worse...

Now I get the "Invalid BLOB Handle in Record Buffer" when I try to Post
a change to a Long VarChar field.  I've tried this on two machines with
the same results.  I now try it on a third machine, guess what, the
application runs exactly as expected (no errors).  This is good because
all I need to do is find the difference between the working and
non-working machines and BINGO problem solved...

Difference 1:  Different version Sybase Clients (working machine is
older).  I upgrade the working machine to the version running on the
non-working machines.  Still no error.

Difference 2:  Different version of Network Clients (working machine is
older).  Same action, application still works.

Difference 3:  Different version of Delphi (working machine has 3.00).
Upgrade to 3.01, application works, upgrade to 3.02, application still
works.

Difference 4:  One non-working machine has BDE 4.51, other does not.
Ruled out because working machine is now on same BDE 4 without problems.

Now we've ruled out the obvious Software version differences.  Time for
theoretical.

Possibility 1:  Application was never run with CachedUpdates enabled on
working machine.  Is there some file that I need to delete somewhere on
non-working machines?  Could this be an after effect of CachedUpdates
haunting me?

Possibility 2:  Both non-working machines are SuperMicro Pentium 200's
w/32MB RAM, working machine is Gateway Pentium 100 with 16MB RAM.  If
this problem is motherboard specific we're hosed.

Possibility 3: (Really LONG Shot) GExperts is installed within Delphi on
both non-working machines.  It is not installed on working machine.  How
this could possibly affect the compiled executable is beyond me, but
it's there.

If any one has any idea's (no matter how far-fetched) I'D REALLY like to
hear them.  Because I'm running out of even the lame ones...

Thanks, Mike.
--
==========================================
=  Michael D. Mount                      =
=  National Field Representatives, Inc.  =
=  Claremont, New Hampshire              =
==========================================

Re:Invalid Blob handle in record buffer?


Another Update:

This appears to be a Borland Database Engine Bug although I am still
unsure as to what is causing it.  Perhaps a BDE API person could help me
out?  The code that is raising this error is in the DBTables unit at
Line #8452.  This is the TBlobStream.Create constructor.  The erroneous
line:

  Check(dbiOpenBlob(FDataSet.Handle, FBuffer, FFieldNo, OpenMode));

The call to dbiOpenBlob is returning error code 10030.

My working and unworking machines are passing the exact same (except the
Handle of course) parameters to the call.  The problem has to arise
within the API call.  Is there some way that I can troubleshoot this
further or do I need to submit a bug report to BORLAND???

BTW: I noticed an unanswered post from last week regarding this same
problem but he was using MSSQL instead of SQL Anywhere, this leads me to
believe that the problem MUST exist within the BDE (be it machine
specific or not).

PLEASE HELP!!!!

Thanks - Mike

--
==========================================
=  Michael D. Mount                      =
=  National Field Representatives, Inc.  =
=  Claremont, New Hampshire              =
==========================================

Re:Invalid Blob handle in record buffer?


Michael

I'm fairly certain that the error is related to the BDE.  It has to do
with the amount of caching the BDE does.

There is an option in the BDE to set the number of BLOBs which will be
cached.  Alter this number and see how you get on.  You should know
that the BDE ALWAYS caches (there is no option to turn it off)

OTOH, ODBC Express has the capability to disable BLOB fetching entirely
until you explicitly call for the BLOB, thereby circumventing all the
problems you're having.

In summary:

1. The problem is with the BDE.
2. Change the BLOBs To Cache option with the BDE Administrator (be
aware that there is an upper limit, though)
3. Check your TQuerys to ensure that you're only pulling back the
information you need (thus reducing the record count and hence the
caching which is done)
4. If all else fails, try ODBC Express and defer BLOB fetching.

Good Luck

Derek Davidson
Get a FREE copy of DK's Audit Components for Delphi from my web site:
http://freespace.{*word*269}.net/d.davidson
Now Includes INFOPOWER Derived components and a demo

(Remove the x to EMail me : der...@mksoft.com)

Re:Invalid Blob handle in record buffer?


Michael

Oops.  Just read this in a message in the SQLA Forum:

Quote
>PLEASE NO MORE PLUGS FOR ODBCExpress!!!  I know
>it's the answer to all lifes problems BUT it's not for me!)

So please edit my earlier reply to your message accordingly.<g>

Derek Davidson
Get a FREE copy of DK's Audit Components for Delphi from my web site:
http://freespace.{*word*269}.net/d.davidson
Now Includes INFOPOWER Derived components and a demo

(Remove the x to EMail me : der...@mksoft.com)

Re:Invalid Blob handle in record buffer?


Quote
Derek Davidson wrote:

Derek,

Quote
> 1. The problem is with the BDE.

Definately.

Quote
> 2. Change the BLOBs To Cache option with the BDE Administrator (be
> aware that there is an upper limit, though)

This option (according to documentation) is only for ReadOnly result
sets, however I tried increasing it (from 64 to 10,000) with no effect.
The upper limit is MaxInt (65,767 ish).  What's suprising to me is that
is is fully functional with the same compiled code on one machine but
not on two others.

Quote
> 3. Check your TQuerys to ensure that you're only pulling back the
> information you need (thus reducing the record count and hence the
> caching which is done)

Oh, but if I could reduce this!

Quote
> 4. If all else fails, try ODBC Express and defer BLOB fetching.

This option is VERY SERIOUSLY being considered.

Thanks, Mike

--
==========================================
=  Michael D. Mount                      =
=  National Field Representatives, Inc.  =
=  Claremont, New Hampshire              =
==========================================

Re:Invalid Blob handle in record buffer?


Derek,

You're fine.  It's just that when I was initially looking for input on
Delphi/BDE/SQLA virtually EVERY response was "Try ODBCExpress" without
any real answers.  I found this to be frustrating and annoying.  I am
currently considering ODBCExpress but am evaluating the amount of code
and procedural changes required to implement it.  It looks like a
one-way street to me.  No easy way to get off the train and back on BDE
(or anything else) should the need arise.  This is an issue that
concerns me but perhaps it shouldn't.

Thanks - Mike

BTW: How's wod50t.dll Build #1704 working for you?

--
==========================================
=  Michael D. Mount                      =
=  National Field Representatives, Inc.  =
=  Claremont, New Hampshire              =
==========================================

Re:Invalid Blob handle in record buffer?


Michael

Quote
> How's wod50t.dll Build #1704 working for you?

As I mentioned in the SQLA forum, not good.  I still get Access
Violations (though at a slightly different address.

Sybase have promised me an ebf, so I wait with baited breath<g>

Derek Davidson
Get a FREE copy of DK's Audit Components for Delphi from my web site:
http://freespace.{*word*269}.net/d.davidson
Now Includes INFOPOWER Derived components and a demo

(Remove the x to EMail me : der...@mksoft.com)

Re:Invalid Blob handle in record buffer?


If anyone's interested,

I found a solution to this (whether it is still a BDE problem, I don't
know).  In the 32-bit ODBC Administrator setting the "Microsoft
Applications(Keys in SQLStatistics)" check box seemed to eliminate the
problem.  I guess this just goes to show that the BDE is just a clever
Microsoft Jet Engine Clone (DUCK AND ROLL, DUCK AND ROLL!) <g>.

- Mike
--
==========================================
=  Michael D. Mount                      =
=  National Field Representatives, Inc.  =
=  Claremont, New Hampshire              =
==========================================

Re:Invalid Blob handle in record buffer?


Quote
Michael Mount <n...@srnet.com> wrote:
>Derek Davidson wrote:
>Derek,
>> 1. The problem is with the BDE.
>Definately.
>> 2. Change the BLOBs To Cache option with the BDE Administrator (be
>> aware that there is an upper limit, though)
>This option (according to documentation) is only for ReadOnly result
>sets, however I tried increasing it (from 64 to 10,000) with no effect.
>The upper limit is MaxInt (65,767 ish).  What's suprising to me is that
>is is fully functional with the same compiled code on one machine but
>not on two others.
>> 3. Check your TQuerys to ensure that you're only pulling back the
>> information you need (thus reducing the record count and hence the
>> caching which is done)
>Oh, but if I could reduce this!

Return the fields you need in the TQuery, and then, in the
OnDataChange event of a TDataSource, retreive the key fields of the
current record, and retreive the blob field for that record.   This
works around the error,  while causing the initial query to return
faster, and consume less of system resources for caching potentially
limitless amounts of blob data.

Michael Godeck
Amherst MA
Ana Maria Gonzalez
a...@soupinc.com

Re:Invalid Blob handle in record buffer?


Ana Maria

Quote
> Return the fields you need in the TQuery, and then, in the
> OnDataChange event of a TDataSource, retreive the key fields of the
> current record, and retreive the blob field for that record.   This
> works around the error,  while causing the initial query to return
> faster, and consume less of system resources for caching potentially
> limitless amounts of blob data.

An interesting solution. I assume that you use a second TQuery to pull
back the BLOB in question, and query it every time the record in the
main Query changes?  If so, though the main table loads quickly, having
to execute the second query every time would, as a whole, slow things
down?

Finally, is there a reason why you wouldn't use the TDataSet OnScroll
event instead of the TDataSource OnChangeEvent?

Derek Davidson
Get a FREE copy of DK's Audit Components for Delphi from my web site:
http://freespace.{*word*269}.net/d.davidson
Now Includes INFOPOWER Derived components and a demo

(Remove the x to EMail me : der...@mksoft.com)

Re:Invalid Blob handle in record buffer?


Quote
Derek Davidson wrote:

> Ana Maria

> > Return the fields you need in the TQuery, and then, in the
> > OnDataChange event of a TDataSource, retreive the key fields of the
> > current record, and retreive the blob field for that record.   This
> > works around the error,  while causing the initial query to return
> > faster, and consume less of system resources for caching potentially
> > limitless amounts of blob data.

> An interesting solution. I assume that you use a second TQuery to pull
> back the BLOB in question, and query it every time the record in the
> main Query changes?  If so, though the main table loads quickly, having
> to execute the second query every time would, as a whole, slow things
> down?

> Finally, is there a reason why you wouldn't use the TDataSet OnScroll
> event instead of the TDataSource OnChangeEvent?

> Derek Davidson
> Get a FREE copy of DK's Audit Components for Delphi from my web site:
> http://freespace.{*word*269}.net/d.davidson
> Now Includes INFOPOWER Derived components and a demo

> (Remove the x to EMail me : der...@mksoft.com)

Hello,
  I did not see you state if this is a live or dead result set.  If it
is live, then BLOBS TO CACHE and BLOB SIZE will have no effect. You are
using Cached Updates also?  If the BLOb size is large, then try
increasing BLOB SIZE.

  Scott
--
BDE Support:
 http://www.borland.com/devsupport/bde
Delphi Support:
 http://www.borland.com/devsupport/delphi
Common Delphi and BDE Questions and Answers:
 http://www.borland.com/devsupport/delphi/qanda/delphi3qa.html

Re:Invalid Blob handle in record buffer?


Quote
Scott Frolich [Borland] wrote:
>   I did not see you state if this is a live or dead result set.  If it
> is live, then BLOBS TO CACHE and BLOB SIZE will have no effect. You
> are
> using Cached Updates also?  If the BLOb size is large, then try
> increasing BLOB SIZE.

Hi Scott,
I will assume that you're responding to my post since Derek has sloved
ALL of his problems <vbg>.  Originally I had:

RequestLive = False
CachedUpdates = True

Changing the BLOBS TO CACHE seemed to have no effect whatsoever.  I set
it to 10000 and still got the error.  The test database table had (2)
BLOB Fields, 500 records, with all but 10 BLOB fields NULL.  Those 10
were under 100 bytes each.  I then changed to RequestLive = True,
CachedUpdates = False, and was still receiving the error.  Suspecting a
new Sybase ODBC driver that I had recently installed to be at fault, I
ran the executable on a machine with the older ODBC driver.  It worked
fine.  So I started upgrading the "working" machine to find out how far
back I had to go to get a working driver.  When I had every possible
piece of software upgraded to the exact same versions and the "working"
machine was still working I gave up for a few days.  It turns out that
setting "Microsoft Applications (Keys in SQLStatistics)" in the ODBC32
administrator seems to have circumvented the problem.  (However, last
weekend at home I was still getting the error but didn't have time to
find out why there).

Thanks for your response.
- Mike

BTW: I still think there is a problem with the BDE in this area (or with
ODBC, or with Delphi itself) but as long as it's working I'm not looking
into much until I get more time.
--
==========================================
=  Michael D. Mount                      =
=  National Field Representatives, Inc.  =
=  Claremont, New Hampshire              =
==========================================

Re:Invalid Blob handle in record buffer?


Michael

Quote
> Derek has sloved
> ALL of his problems <vbg>.

Oh I wish, I wish...... <g>

Derek Davidson
Get a FREE copy of DK's Audit Components for Delphi from my web site:
http://freespace.{*word*269}.net/d.davidson
Now Includes INFOPOWER Derived components and a demo

(Remove the x to EMail me : der...@mksoft.com)

Go to page: [1] [2]

Other Threads