Storing a MS-Word file into an Oracle blob field, retreive it and display it into an OLEContainer

Storing a MS-Word file into an Oracle blob field, retreive it and display it into an OLEContainer

Post by bruno etienn » Sun, 31 Dec 1899 09:00:00



Thank you Steve but it's not working.

I'have got this message :

EDBEngineError with message 'General SQL error.
 ORA-01461: can bind a LONG value only for insert into a LONG column'.

The oracle field type is 'blob'.
and 'aQuery.Params[0].LoadFromFile('c:\MyWordFile.doc') does not compile.'

I used   aQuery.Params[0].LoadFromFile('c:\MyWordFile.doc', ftBlob) .

Same problem with the your second option (TFileStream, ...)

Do you have any other solution ?.

Thanks you very much for your help.

Bruno ETIENNE
Rueil-Malmaison
France



> On Thu, 4 Nov 1999 22:53:16 +0100, "bruno etienne"

> >Everything is in the subject.
> >In order to store the file in Oracle 8.0.4, I did  :

> >aQuery.SQL.Add('insert into MyTable(Field1, BlobField) values (''hello'',
> >:myblob) ');
> >aQuery.Prepare;
> >aQuery.Params[0].AsBlob := 'c:\MyWordFile.doc';
> >aQuery.ExecSQL;

> >A record is created without any error. (I'm not sure that the storage is
OK
> >, it's something like a WOM, write only memory :-))) ).

> >But, how to retrreive and display the data into an OLEContainer ?

> >I tried to use a stream, but I have an error message, something like 'bad
> >stream format'.
> >(I tried to initialize the stream with the blobfield and use the
procedure
> >loadfromfile.

> >I red many articles and FAQ about this subject, but I did not find any
> >solution. I'm the only person on earth to have this problem ?

> 'c:\MyWordFile.doc' is a string, not binary data. One thing you might try
> is using the TParam.LoadFromFile method.

>   aQuery.Params[0].DataType := ftBlob;
>   aQuery.Params[0].LoadFromFile('c:\MyWordFile.doc');

> Another option is a TFileStream. Copy from stream to TParam object using
> the TParam.LoadFromStream method. Something like:

>   var
>     FS: TFileStream;
>   begin
>     FS := TFileStream.Create('c:\MyWordFile.doc', fmOpenRead);
>     try
>       FS.Seek(0, soFromBeginning);
>       ...
>       aQuery.Params[0].LoadFromStream(FS);
>       ...
>     finally
>       if Assigned(FS) then FM.Free;
>     end;
>   end;

> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
> Steve Koterski              "Health nuts are going to feel stupid someday,
> Felton, CA                  lying in hospitals dying of nothing."
>                                                               -- Redd Foxx

 
 
 

Storing a MS-Word file into an Oracle blob field, retreive it and display it into an OLEContainer

Post by bruno etienn » Sun, 31 Dec 1899 09:00:00


Thank you Steve but it's not working.

I'have got this message :

EDBEngineError with message 'General SQL error.
 ORA-01461: can bind a LONG value only for insert into a LONG column'.

The oracle field type is 'blob'.
and 'aQuery.Params[0].LoadFromFile('c:\MyWordFile.doc') does not compile.'

I used   aQuery.Params[0].LoadFromFile('c:\MyWordFile.doc', ftBlob) .

Same problem with the second option (TFileStream, ...)

Do you have any other solution ?.

Thanks you very much for your help.

Bruno ETIENNE
Rueil-Malmaison
France



> On Thu, 4 Nov 1999 22:53:16 +0100, "bruno etienne"

> >Everything is in the subject.
> >In order to store the file in Oracle 8.0.4, I did  :

> >aQuery.SQL.Add('insert into MyTable(Field1, BlobField) values (''hello'',
> >:myblob) ');
> >aQuery.Prepare;
> >aQuery.Params[0].AsBlob := 'c:\MyWordFile.doc';
> >aQuery.ExecSQL;

> >A record is created without any error. (I'm not sure that the storage is
OK
> >, it's something like a WOM, write only memory :-))) ).

> >But, how to retrreive and display the data into an OLEContainer ?

> >I tried to use a stream, but I have an error message, something like 'bad
> >stream format'.
> >(I tried to initialize the stream with the blobfield and use the
procedure
> >loadfromfile.

> >I red many articles and FAQ about this subject, but I did not find any
> >solution. I'm the only person on earth to have this problem ?

> 'c:\MyWordFile.doc' is a string, not binary data. One thing you might try
> is using the TParam.LoadFromFile method.

>   aQuery.Params[0].DataType := ftBlob;
>   aQuery.Params[0].LoadFromFile('c:\MyWordFile.doc');

> Another option is a TFileStream. Copy from stream to TParam object using
> the TParam.LoadFromStream method. Something like:

>   var
>     FS: TFileStream;
>   begin
>     FS := TFileStream.Create('c:\MyWordFile.doc', fmOpenRead);
>     try
>       FS.Seek(0, soFromBeginning);
>       ...
>       aQuery.Params[0].LoadFromStream(FS);
>       ...
>     finally
>       if Assigned(FS) then FM.Free;
>     end;
>   end;

> _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
> Steve Koterski              "Health nuts are going to feel stupid someday,
> Felton, CA                  lying in hospitals dying of nothing."
>                                                               -- Redd Foxx


 
 
 

1. Storing a MS-Word file into an Oracle blob field, retreive it and display it into an OLEContainer

Hello,

Everything is in the subject.
In order to store the file in Oracle 8.0.4, I did  :

aQuery.SQL.Add('insert into MyTable(Field1, BlobField) values (''hello'',
:myblob) ');
aQuery.Prepare;
aQuery.Params[0].AsBlob := 'c:\MyWordFile.doc';
aQuery.ExecSQL;

A record is created without any error. (I'm not sure that the storage is OK
, it's something like a WOM, write only memory :-))) ).

But, how to retrreive and display the data into an OLEContainer ?

I tried to use a stream, but I have an error message, something like 'bad
stream format'.
(I tried to initialize the stream with the blobfield and use the procedure
loadfromfile.

I red many articles and FAQ about this subject, but I did not find any
solution. I'm the only person on earth to have this problem ?

Thanks for your help.

Bruno

2. DataSource Property Q??

3. Storing/Retreiving/Saving Word Doc to Blob on web

4. Best way to define a unique indentity

5. displaying blob as ms-word in browser(ie) window

6. Querying Sql from web using IIS

7. How do I store/display ms-word documents?

8. display int as words

9. Displaying Images stored in a BLOB Datatype Field

10. CA-MILPITAS-111217--Management-MS Office-MS Word-MS Excel-MS ACCESS-ORACLE-GROUP CONTROLLER