Solved

Storing/Retrieving Oracle BLOB fields

Posted on 2004-08-18
4
758 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 25

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 25

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

832 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