Previous Thread

8/8/2006 6:21:26 AM    Multi threading with ODBC
I am writing a multi threaded Client Server application. I have written a dll 
 
in .Net to perform the database related operations. I am using connection 
 
pooling. Now I have a function in the database dll. When multiple threads 
 
enter in that function , I am getting the imporper results. 
 
So , I thought of using transactions in that particualr function. But it is 
 
causing the deadlock in the application. 
 
Can anyone help me ? Is my desgin/architecture wrong > or there is something 
 
else i m missing > 
 
Regards



8/16/2006 8:12:28 PM    Re: Multi threading with ODBC
If you're getting deadlocks, then it probably is an architecture 
 
thing. This happens when two different processes are contending for 
 
the same resource in order to complete a transaction, so one process 
 
is arbitrarily picked as a deadlock victim. When coding your 
 
transactions, make sure you're accessing resources in the same order. 
 
For example, process 1 locks table A and needs B, and process 2 locks 
 
B and needs A. If both processes access A first and then B, the second 
 
process just goes into the wait queue until the first process 
 
completes, which is usually in sub-second response time, unless you've 
 
committed other transactional sins such as using pessimistic locking 
 
or cursors. 
 
--Mary 
 
On Tue, 8 Aug 2006 06:21:26 -0700, Munish 
 
<Munish@discussions.microsoft.com> wrote: