Solved

Storing/Retrieving Oracle BLOB fields

Posted on 2004-08-18
4
748 Views
Last Modified: 2010-05-18
Hi,

I need to know which is the best way (most efficient) to save and retrieve files from an Oracle BLOB field.

Should I use a normal table component ie.

Database.StartTransaction;
Table.Insert;
Table KEYFLD.AsInteger := new_val;
Table TESTFLD.LoadFromFile('D:\data\test.bmp');
Table.Post;
Database.Commit;

or a TQuery component, or is there another better method.

Code examples will be appreciated.

Regards

0
Comment
Question by:barnarp
  • 2
  • 2
4 Comments
 
LVL 24

Accepted Solution

by:
Tomas Helgi Johannsson earned 125 total points
ID: 11839035
         Hi

Use this method when posting to Oracle

with tTable do
begin
Insert;
TBlobField(FieldByName('PICTURE')).LoadFromFile(OpenPictureDialog1.FileName);
Post;
end;

Take also look at EDBImage and QREDBImage v.1.4  found on http://www.torry.net/pages.php?id=533.
If you want to post JPEGs to Oracle just remember to include jpeg in the uses clause.

Regards,
  Tomas Helgi
0
 
LVL 24

Expert Comment

by:Tomas Helgi Johannsson
ID: 11839085
Similar with retrieving

with tTable do
begin
.....
TBlobField(FieldByName('PICTURE')).SaveToFile(filename);
.....
end;

Regards,
  Tomas Helgi
0
 

Author Comment

by:barnarp
ID: 11839594
Thanks
0
 

Author Comment

by:barnarp
ID: 11867222
Hi,

I seem to be experiencing a problem with the ttable.

I have the following code as you suggested:

begin
   Open;
   Insert;
   TBlobField(FieldByName('CPLANT_BLOB')).LoadFromFile(DocCopyComment);
  Post;
end;

The moment I run Open, I get the following error:

General SQl Error ORA-000936: Missing Expression

Any idea what is going wrong?
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now