Need help with TOracleSessionPool

Robertas

Member²
Hello,

i'm trying to use TOracleSessionPool. What i did is:
1. drop on form a OSP: TOracleSessionPool component
2. drop on form two buttons
3. button1:
with TOracleSession.Create(nil) do begin
Pooling:= spInternal;
LogonUsername:= '..';
LogonPassword:= '..';
LogonDatabase:= '..';
Pool:= OSP;
LogOn;
end;
4. button2:
OSP.Compress;

the problem (or maybe i do not know something) is:
when i press button1 a new oracle session is created, count property of pool is increased
but when i press button2 i expect TOracleSessionPool to release connection and count property to decrease, but the session remains connected, count does not decrease and i can see this session in v$session

I'v tried to play with TimeOut property and CompressOld but got no results

Could you please explain me what am i doing wrong?
 
The idea of a pool is to keep the connection alive. This way you can use existing connections without having to reconnect/disconnect.

The TimeOut property and CompressOld procedure depend on the Min property. If it is set to 1, then you will always keep 1 connection, regardless of the TimeOut property. See also the User's Guide.
 
I understand the idea of a pool, I just don't want to talk about details of how i will use it.

Ok, I made the following:
set Min property to 1
set TimeOut property to 5 seconds
i created 3 transactions (as shown in my first post)
wait for 10 seconds
call CompressOld
and I get the count of 3 and not 1 as it should be
I also tried to call Compress, but result is the same.

I was reading help about TOracleSessionPool but found no answer. You are the last hope for me to understand what I'm doing wrong.

Could you please paste in here a working example that creates some count of sessions and calls Compress or CompressOld and in result I'll get the count equal to Min property

Thanks
 
Did you log off 2 of the 3 sessions? This will release the connection in the pool, so that they can be disconnected when things time out.
 
Correct me if I'm wrong

when I call LogOff method for, let us say, OSP.Sessions[0] it becomes nil, but OSP is still holding the connection to Oracle (I see it from v$session). And when I create new session, assign a pool to it and call LogOn method, OSP takes the connection it was holding (instead of creating new) and assigns a pointer to that session to OSP.Sessions[0]

is that right?

Thank you for replies.
 
Back
Top