Board index » delphi » troubles storing blob >32KB

troubles storing blob >32KB

Hi,

Using Delphi 4, I'm trying to store a binary file (up to 1MB) on a MSSQL

server using a AstaClientDataSet that connects to a AstabdeServer on the

MSSQL server..

But I only can store and fetch files smaller than 32KB :-(

I'm using an AstaClientDataSet (v2.060) to connect to the AstabdeServer
(v1.91),
running on the MSSQL  (v7.00.699) server.

In my BDE administrator (v5.01) I've set the BLOB SIZE to 1024,
and on the MSSQL server I've changed the size of the image datatype to
1024.
I can't find anything to configure the blobsize on the AstaClientDataSet

I've traced on the MSSQL-server while storing a big file, and I noticed
the following :
a lot of errors (while storing >32KB),
disconnect,
connect,
existingconnection,
exec sp_server_info 18,
use MyProjectDB,
set textsize 32768  <-- !!!

But where does this last line comes from ??

Can anyone help me out of this ?

thanx,
Walter Smet
Schelfhout Computer Systemen

 

Re:troubles storing blob >32KB


<<Using Delphi 4, I'm trying to store a binary file (up to 1MB) on a MSSQL

server using a AstaClientDataSet that connects to a AstabdeServer on the

MSSQL server..

But I only can store and fetch files smaller than 32KB :-(

Quote

It's a bde issue.

Quote
> -----Original Message-----
> From: Steve Garland [mailto:sgarl...@astatech.com]
> Sent: Friday, March 03, 2000 7:47 AM
> To: Alvin Austin
> Subject: Re: Problem accessing BLOB images in MS-SQL 7 with
> AstabDEserver

Hi Steve,

No questions this time; just answers! :-)

Here is some information I discovered about dealing with BDE, Asta,
and image bitmaps (for your "information store").

1) The key to getting complete bitmaps from an MS-SQL table through the
BDE is to go into BDE Administrator and set the "BLOB SIZE" parameter
for the alias to be as big as the largest image you are saving.
Borland calls this field the "maximum allowable blob size (in
kilobytes) for canned queries".  So this value is not used if you are
accessing the data through tables, only if you are using SQL queries.

The connection must be closed in order to change the BLOB SIZE value
in the BDE Administrator.

2) Here are three(!) interesting ways to access the bitmap from an
AstaClientDataSet, depending on what you want to do.

/*
I didn't have any success with the following from your example:

 var
  s:String;
 begin
   // Pass the table, the field name & a SQL String
   S:=AstaClientDataSet1.FetchBlobString('aaaaa','TheImage','');
   //new string to stream requires AstaUtil in the uses
   Image2.Picture.Bitmap.LoadFromSTream(NewStringToStream(s));
*/

But these (simpler) methods work fine...

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
    // Copies the bitmap image from a DBImage to a TImage
    // where dbImage1 is linked through a DataSource to an
    // AstaClientDataSet.
    Image2.Picture.Assign(dbImage1.Picture);
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
    // Copies the bitmap image directly from the AstaClientDataSet field
    // to a TImage.
    with AstaClientDataSet1 do
    begin
        if (Active = false) or (FieldCount = 0)
        then Image2.Picture := nil
        else Image2.Picture.Assign(FieldByName('TheImage'));
    end;
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
var
    aBitmap : TBitmap;
begin
    // Copies the bitmap image from an AstaClientDataSet field
    // to a TBitmap, and then from there to a TImage (to show it worked).
    aBitmap := TBitMap.Create;
    with AstaClientDataSet1 do
    begin
        if (Active = false) or (FieldCount = 0)
        then aBitmap := nil
        else aBitmap .Assign(FieldByName('TheImage'));
    end;
    Image2.Picture.Bitmap.Assign(aBitmap);
end;

FYI, and have a great day!
Alvin

Alvin
---

--
Steve Garland sgarl...@astatech.com
Code it once with ASTA and run it anywhere
Servers (Win32,Linux) Clients (Win32,Linux,Java,Palm)
ASTA News Groups news://news.astatech.com
ASTA Technology Group http://www.astatech.com

Re:troubles storing blob >32KB


Hi,

i had similar problems with the BDE. I found out that TQuery was the problem
(for me). My first work-a-round was to store the blob with a TTable. This
worked but was silly (store normal data with TQuery and Blob with TTable..).
Now i'm using ODBCExpress.

cu

Boris
--
---
Delphi Tips: http://www.nsonic.de/Delphi
Homepage: http://www.nSonic.de
E-Mail: bnie...@nsonic.de

Walter Smet <Walter.S...@schelfhout.com> schrieb in im Newsbeitrag:
39759720.E4B88...@schelfhout.com...

Quote
> Hi,

> Using Delphi 4, I'm trying to store a binary file (up to 1MB) on a MSSQL

> server using a AstaClientDataSet that connects to a AstabdeServer on the

> MSSQL server..

> But I only can store and fetch files smaller than 32KB :-(

Re:troubles storing blob >32KB


Hi,
try to store the blob-part of the record with a separate edit - post, or
better, do a separte SELECT (requestLive=true), edit, assign the blob, and
Post. Works fine for me.

Anton Santa
SABE SOFT

--------------------------

"Walter Smet" <Walter.S...@schelfhout.com> ha scritto nel messaggio
news:39759720.E4B887F7@schelfhout.com...

Quote
> Hi,

> Using Delphi 4, I'm trying to store a binary file (up to 1MB) on a MSSQL

> server using a AstaClientDataSet that connects to a AstabdeServer on the

> MSSQL server..

> But I only can store and fetch files smaller than 32KB :-(

> I'm using an AstaClientDataSet (v2.060) to connect to the AstabdeServer
> (v1.91),
> running on the MSSQL  (v7.00.699) server.

> In my BDE administrator (v5.01) I've set the BLOB SIZE to 1024,
> and on the MSSQL server I've changed the size of the image datatype to
> 1024.
> I can't find anything to configure the blobsize on the AstaClientDataSet

> I've traced on the MSSQL-server while storing a big file, and I noticed
> the following :
> a lot of errors (while storing >32KB),
> disconnect,
> connect,
> existingconnection,
> exec sp_server_info 18,
> use MyProjectDB,
> set textsize 32768  <-- !!!

> But where does this last line comes from ??

> Can anyone help me out of this ?

> thanx,
> Walter Smet
> Schelfhout Computer Systemen

Other Threads