Print Thread
Fastest images upload
#6184 03/16/04 05:05 PM
Joined: Mar 2004
Posts: 1
Plzen, Czech Rep.
T
Member
OP Offline
Member
T
Joined: Mar 2004
Posts: 1
Plzen, Czech Rep.
I need the fastest image upload in the Oracle BLOBs. I must make continual uploads of about 1000 images of 500K. What is the fastest way?

I made:
.....
/* qryInsertImage =
INSERT INTO IMAGE.KS_IMAGE_DATA_POKUS
(IMAGE_ID, DATA)
VALUES(:IMAGE_ID, EMPTY_BLOB())
RETURNING DATA INTO :DATA */

TLOBLocator *xLOBLoc;
AnsiString xFileName;
Connect();
for ( int n = 1; n <= 1000; n++ )
{
qryInsertImage->SetVariable("IMAGE_ID", n);
xLOBLoc = new TLOBLocator(OracleSession1, otBLOB);
qryInsertImage->SetComplexVariable("DATA", xLOBLoc);
qryInsertImage->Execute();
xFileName = "DicomFile" + AnsiString(n) + ".dcm";
xLOBLoc->LoadFromFile(xFileName);
delete xLOBLoc;
OracleSession1->Commit();
}
OracleSession1->LogOff();

Is it the fastest way?
Is this faster way then the TOracleDataSet? I think so, it does not create memory structures of all table rows as TOracleDataSet.
Have I to do COMMIT after every row? COMMIT clears rollback segments.
I think, creating and destroying the TLOBLocator is slow, can I reuse object?
How can I make physical parameters of Oracle table, the CHUNK, INITIAL, NEXT for instance?
Can I make directly upload of image without returning clause:
INSERT INTO IMAGE.KS_IMAGE_DATA_POKUS
(IMAGE_ID, DATA) VALUES(:IMAGE_ID, :DATA)
on Oracle 9.2. database?

Thank You, very much!


Tomas Holecek
FN Plzen, Czech Republic
holecekt@fnplzen.cz
Re: Fastest images upload
#6185 03/16/04 11:14 PM
Joined: Aug 1999
Posts: 22,206
Member
Offline
Member
Joined: Aug 1999
Posts: 22,206
This is probably the fastest method, though you can commit every X records to minimize commit overhead, and you can read the file into memory and write it to the database in one call through TLOBLocator.Write (instead of LoadFromFile).

To use an Insert statement without a returning clause, you can use a Temporary BLOB (TLOBLocator.CreateTemporary). This requires Direct Oracle Access 4.0.


Marco Kalter
Allround Automations

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.059s Queries: 14 (0.031s) Memory: 2.4990 MB (Peak: 3.0393 MB) Data Comp: Off Server Time: 2024-04-29 01:07:19 UTC
Valid HTML 5 and Valid CSS