Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Design question: OCI & batch processing & sessions & transaction

Design question: OCI & batch processing & sessions & transaction

From: Alexandru Sclearuc <asclearuc_at_yahoo.com>
Date: 6 Aug 2004 08:28:29 -0700
Message-ID: <b212587c.0408060728.20513aba@posting.google.com>


Hi everybody,

I have a question about what design more suitable for next task:

So, there is a library that receives requests and executes them on Oracle database (it is written using OCI). Library is multithreading
(the same as application).

Now there is need to add next facility to the library: batch processing.
Each batch would have id and part number. Each batch is a transaction
(not a batch part, but the whole batch)

So, the library should understand next (inside one thread):

   ExecuteRequest(req_no_batch);  // executed inside one transaction
   ExecuteRequest(req_batch1_p1); // transaction for batch1 part1 open
   ExecuteRequest(req_batch1_p2);
   ExecuteRequest(req_batch2_p1); // transaction for batch2 part1 open
   ExecuteRequest(req_batch2_p0); // transaction for batch2 committed
   ExecuteRequest(req_no_batch);  // again, executed inside one
transaction

   ExecuteRequest(req_batch1_p0); // transaction for batch1 committed

So, after I read documentation I found this way to solve it: to use sessions.
My idea is to use one session for no batch processing requests (where one request is a transaction), and a pool of sessions for each batch request
(map by id or smth like that).

And to substitute during each active session id in service handle
(OCISvcCtx).

And here my question come:

  1. What I do not like in this design - that each session requires log-in process. Is any other way to implement this, taking into consideration that all this executed by the same user...
  2. One more black spot for me: how correctly (without memory leaks) to close sessions? E.g. in example shown above, when batch2 ends - after OCITransCommit() what should be performed? OCISessionEnd()? Or it may be skipped? And need I to deallocate session handles? Or may be not? May be something may be used when next sessions would be created?

Looking forward to your replies,
Alex Received on Fri Aug 06 2004 - 10:28:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US