Problem using BLOB fields in MySQL with DBExpress


I am using MySQL v.3.23.49 with DBExpress on Win2000.
I managed to get Libmysql.dll from that distribution to work with
Delphi UpdatePack 1 (by switching to dbexpmysql.dll instead of
dbexpmys.dll). I cannot use UpdatePack 2 since I am working with a
german version, which is definitifely crashing after the Pack2

So far, everything just works fine. Since I started to use BLOB fields
in the DB and retrieving them with a TSQLDataSet component, I get an
EInvalidPointer exception when _closing_ the DataSet. But, and this is
really weird, not all the time. Sometimes its working, sometimes not.
If not, it crashes in TCustomSQLDataSet.FreeBuffers which is called by
TCustomSQLDataSet.InternalClose in the unit SQLExpr.pas. There it comes
to the line

procedure TCustomSQLDataSet.FreeBuffers;
  if FBlobBuffer <> nil then
    SetLength(FBlobBuffer, 0);      // EInvalidPointer Exception

When I check that FBlobBuffer variable, it seems to be assigned
correctly and Length(FBlobBuffer) gives a reasonable value of 20, which
is about the size of the BLOB field contents I use.

Any ideas what could happen here? By the way, this is also happening
when using the old libmysql.dll from distribution 3.22 together with

It drives me crazy, I cannot continue my work, because I need these
blob fields.

Maybe you want to see the code from where it all started:

with DataSystem do begin
    SystemDataSet.CommandText:='SELECT StrVal, BlobVal FROM SYSTEM
WHERE Param=:Param';
    if not SystemDataSet.Eof then begin
        // this is legal for BLOBs !
      // here it crashes, but only when using the BLOB in SQL

First I used SystemDataSet.Open and Close instead of
Active:=true/false. When I changed it, everything seemed to work fine,
but then, after adding some lines of code somewhere else, it happened

I know about the problems which arise when using MySQL v.3.23 with
DBExpress. But according to the release notes of Borlands UpdatePack1
the new driver dbexpmysql.dll has specific support for mysql 3.23.

Any help would be appreciated much! Thank you

Roger Stocker