Print Thread
Binary data saved into Data base via DOA are corrupted?
#94 10/20/99 04:54 AM
Joined: Oct 1999
Posts: 2
Richmond, BC, Canada
H
Member
OP Offline
Member
H
Joined: Oct 1999
Posts: 2
Richmond, BC, Canada
Hello there,

I have been using DOA version 3.3 with Delphi 4, Oracle server 7.3.

The problem I've been encountering is saving data in binary format (BLOB field) into database is always corrupted.

This happens with Report Builder or just simply saving data with TBlobField. (TBlobfield.SaveToFile and TBlobField.LoadFromFile)

I have tried to compare a custom made binary file containing all characters from 0x00 to 0xFF, save into database and load from database through DOA, and found that all characters from 0x00 to 0x20 are not saved in the blob field in database.

This is a DOA issue since we could save binary data in blob field with BDE without any problem.

Please look into that and if there is any suggestions, please feel free to share with us.

Thanks.

- Howard Roy

Re: Binary data saved into Data base via DOA are corrupted?
#95 10/20/99 08:25 PM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
I have tried to reproduce the problem like this:

[quote]
Code
with BlobDataSet do
begin
  Insert;
  BlobField.LoadFromFile('c:\temp\data_in.dat');
  Post;
  BlobField.SaveToFile('c:\temp\data_out.dat');
end;
[/quote]

The file is about 71KB big, and the output file is exactly the same as the input file. The blob field is a long raw column in an Oracle7 database table. After refreshing the dataset the contents of the blob field are still correct.

Perhaps there is something specific about your application or about your Oracle installation. Could you try to send me a project to reproduce the problem?


------------------
Marco Kalter
Allround Automations


Marco Kalter
Allround Automations
Re: Binary data saved into Data base via DOA are corrupted?
#96 10/20/99 11:26 PM
Joined: Oct 1999
Posts: 2
Richmond, BC, Canada
H
Member
OP Offline
Member
H
Joined: Oct 1999
Posts: 2
Richmond, BC, Canada
Hi there,

I've the similar code as you have written there, but the saving and loading are placed in 2 different procedures instead of one.

in function one I have :
with qrySomething do
begin
TBlobField(FieldByName('FILE_DATA')).SaveToFile(filename);
end;

and in another function I have :

with qrySomething do
begin
Insert;
TBlobField(FieldByName('FILE_DATA')).LoadFromFile(filename);
Post;
end;

---

The binary data column in Oracle 7.3 table is also LONG RAW, and I have used TBlobField.BlobSize to verify the file size.

I have noticed that when the blobfield load the binary data from file, the binary data size is actually correct, it's when the data POST to database, then retrieve from database the binary data get corrupted. (ie. 0x00 to 0x20 characters missing)

We have tried to duplicate the code with BDE and found that using exactly the same code with a BDE dataset can save blob field into database (after POST) without corruption.

Moreover, once the data was saved into database via BDE, then DOA can retrieve the binary data and SaveToFile correctly.

So I believe it might be something to do with the posting to database through DOA.

Have you try to open the binary data and check for any 0x00 to 0x20 characters? Usually in a 1 or 2 MB file that'll be around 1k to 2k smaller in size, it would be best if you manually generate a binary file with all characters from 0x00 to 0x20, and test the code again.

Thanks.

- Howard Roy.


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.028s Queries: 13 (0.005s) Memory: 2.5103 MB (Peak: 3.0437 MB) Data Comp: Off Server Time: 2024-05-20 03:21:55 UTC
Valid HTML 5 and Valid CSS