Forum OpenACS Q&A: Response to Beginners Question on Processes/ Database Pools / Threads

I read the database api source code, but I do not really understand the way transactions are done: The release unused handle statements are _after_ the "abort transaction" statements. I can't explain to me why the database is rolling smth. back when statements are done with different handles from different pools.

Could you rephrase this? I don't understand what the problem is. You send 'abort transaction' to a handle, then release it. Seems proper to me.

Why do I need a new handle for every statement?
The code looks like that. Couldn't I simply use one handle for alle statements including "begin transaction" ... (statements) ... "end transaction" ? This would make sense to me: If I release the handle or say "end transaction" the db knows what to do: rolling back.

But it seems like this to me (or am I wrong?):


1. Take a handle and use it to say "begin transaction" (from pool1)
2. Take a new handle and use it to do updates etc. (from pool2)
3. Take again a new handle and use it to delete etc. (from pool3)
4. Use handle from (1) and say "abort transaction"
5. Release unused handles...

Why can't I release the handles from (2) and (3)?

There are only three pools defined. What if I need another dml statement in the transaction?

Sorry that I'm so confused...

Maybe it does not matter what handle from what pool one uses because the database driver knows that it comes from the same AOLserver process (or thread)???