Page 1 of 1

Calling CoInitialize and COUninitialize in the same thread?

Posted: Sun 05 Dec 2004 13:23
by Moacir Schmidt
Hi!

I'm having some problems (Acesss Violations and so on) in destruction codes of my DLL. I Have an ISAPI Application that has a pool of connections shared between several user requests. I've read that I had to call CoInitialize at begining of each thread and CoUninitialize at the end. But, I cannot CoUnitilialize the driver at the end of each thread cause the connection is part of a pool and i of course would like to reuse it in a next user request. Is there any kind of solution to this problem?

Perhaps there is no relation between couninitialize and my connection? Can I Keep the connection after a counitilialize calling?

I'm already using the latest version of the driver (2.0.3)

Posted: Sun 05 Dec 2004 13:45
by Moacir Schmidt
Well, I Think my problem has nothing to do with the correct Co(Un)Initialize balancing, I put it on the right way (at the start and the end of the thread) and still have the same problem. Access violation occurrs when another connection is peek from the pool....When the connection is created the problem does not happen, When the connection is reused, the problem does happen...

Re: Calling CoInitialize and COUninitialize in the same thread?

Posted: Mon 06 Dec 2004 15:53
by Ikar
It seems a specific of MS OLE DB working - if there is an open connection then for a thread in what it was created it is not allowed to call CoUninitialize.