OCI Oracle 8.1.7 How to emulate connection pooling?

From: Tomislav <shaka_at_envox.hr>
Date: Mon, 25 Feb 2002 16:49:16 +0100
Message-ID: <MRLN550414836E_at_merlin.envox.hr>


Configuration: MS Win2k SP2, MS Visual C++ 6.0 SP6, Oracle 8.1.7 via OCI

I know that OCI in Oracle 9i supports Connection pooling.

I would like to know how to manage connection pooling on my own in Oracle 8.1.7, by using OCI functions.

If a connection is shared between multiple user sessions, which handles do I need separate for each user session, and which can be connection based?

For example:

Connection:

  • Enviroment handle
  • Server handle

...open: initialize enviroment handle, alloc & attach server handle to server
...close: dettach & free server handle, free env handle

User session:

  • Service Context:
  • Session ( enviroment & server handles are passed on from Connection)

...open: alloc service context & link it with server handle from opened Connection, alloc session handle & put sec.attributes in it & begin session ...close: close session & free session handle, free service context handle

I thought about putting user session & service context in the Connection as well but then again how to separate transactions from different user sessions?

However, there is a problem with my example:
- Close part of user session doesn't free any handles after close session -
OCIHandleFree returns -2 (invalid handle) and memory usage goes up and up - until end of process. Is it a problem to free service context & session handles before dettaching server handle? How to manage my connection pooling in that case?

Any ideas on this subject?

--
--
/Tomislav.
Received on Mon Feb 25 2002 - 16:49:16 CET

Original text of this message