Page 1 of 1

Direct connection and OraLoader

Posted: Mon 09 Oct 2017 18:31
by jjeffman
Hello,

I am using ODAC version 9.7,26 for C++Builder 6.0 Professional and I would like to know if it is possible to use TOraLoader when TOraSession is connected to the Oracle server in direct mode?

Can someone point me an example on using TOraLoader with C++ Builder ?

Thank you very much.

Best regards.

Jayme Jeffman Filho.

Re: Direct connection and OraLoader

Posted: Wed 11 Oct 2017 13:08
by MaximG
You can run OraLoader when using ODAC Direct Mode with LoadMode = lmDML. For example, create the following table:

Code: Select all

CREATE TABLE MyLoadedTable (ID NUMBER, StrValue VARCHAR2 (128))
Then we implement the logic for populating the MyLoadedTable table to insert 10 entries in the OraLoaderGetColumnData handler:

Code: Select all

void __fastcall TForm1 :: OraLoaderGetColumnData (TObject * Sender, TDPColumn * Column, int Row, Variant & Value, bool & IsEOF)
{
switch (Column-> Index)
{
case 0: Value = Row; break;
case 1: Value = "Values" + IntToStr (Row); break;
default: Value = Null;
}
IsEOF = Row> 10;
}

Now you can use OraLoader:

Code: Select all

{
...
OraSession-> Connect ();
OraLoader-> LoadMode = lmDML;
OraLoader-> TableName = "MyLoadedTable";
OraLoader-> Load ();
...
}

Re: Direct connection and OraLoader

Posted: Wed 11 Oct 2017 14:09
by jjeffman
Hello Maxim,

Thank you very much for answering me.

So, as I can learn from your answer, the "GetColumnData" event is the code point where I should put a "get next CSV line" to feed the columns data.

I have thought TOraLoader was an implementation of the work SQL*Loader does reading text files, but it does more as I can feed columns values from any source.

Is there a better approach to load text files data into Oracle tables ?

Best regards.

Jayme Jeffman Filho

Re: Direct connection and OraLoader

Posted: Wed 11 Oct 2017 17:34
by jjeffman
Hello Maxim,

I would also like to know about the point of committing data to the database, as long as the component itself does not have any property which can indicate how many rows to load between commits.

Thank you very much.

Best regards.

Jayme Jeffman

Re: Direct connection and OraLoader

Posted: Mon 07 May 2018 14:23
by MaximG
The functionality you are interested in is absent in the TOraLoader component

Re: Direct connection and OraLoader

Posted: Mon 07 May 2018 14:45
by jjeffman
Hi Maxim

Thank you very much for answering me.

I am filling up a TVirtualTable whitin a while loop and calling TOraLoader::LoadFromDataSet when the VirtualTable has a certain number of rows, to break the operation in blocks and let the users get acces to data just imported more quickly.

Best regards.

Jayme Jeffman

Re: Direct connection and OraLoader

Posted: Mon 07 May 2018 15:27
by MaximG
We are glad that you could find a necessary solution. Contact us with any questions about using our products