Is there a way to return a connection to the pool while a service operation still executing?

I have a service operation that I need access to database only to check to check if a user is valid, after this the service executes a long process and I dont want to keep the conection in the entire process,
something like this.

procedure LongProcesss(...)

functionr userOk : boolean;
connection = get connection
check if user is valid
connection = nil

Will the above call to longprocess take a conection from the pool and release it to the pool, so a second
call to longprocess will use the same connection from the pool while the first call still executing?

Thanks in adavance,

Omar Zelaya

Actually, not use the same connection from pool on second call. I mean will the connection will be available from the pool for another call to LongProcess after userOk is called?

Thanks In Advance,

Omar Zelaya

get connection = TXDataOperationContext.Current.GetManager

Yes. Once you release the connection with Connection := nil it will be available in the pool again (as long as you don't have other references to the same connection interface, of course).