Posted By: tholecek Fastest images upload - 03/16/04 05:05 PM
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!
Posted By: Marco Kalter Re: Fastest images upload - 03/16/04 11:14 PM
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.
© Allround Automations forums