Timeout error with Transactions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I open a transaction, peform a select from the database using the
transaction, and then try to perform another select from the database with a
separate connection that does not use the transaction, I get a timeout error.
Also, this is only with a piece of code written in .Net 1.1 Framework. When
I run a different piece of code written in 2.0, I do not have this problem.

Is this because this is simply something that was added in ADO.Net 2.0, or
is there something else different about my data access code that blocks the
second connection? I am having trouble telling, since I did not write either
of the data access components that these two different products use.
 
When you query something in a transaction - that can lock the row. If the
transaction has not yet been committed or rolled back, and other connections
try to get the data, they are forced to wait. Since this is all code running
on one logical thread, eventually the second connection times out because
the first one never releases the lock.

You can't compare differences between 1.1 code and 2.0 , if you aren't
actually running identical code in both scenarios. It's possible the
deadlocking code would always timeout like this no matter what framework was
used at compile time. And the code you are now using under 2.0, could be
written in such a way that means it wont' ever deadlock. You can't compare
apples and oranges this way - you need to be running your experiments using
the same source code.
 
Back
Top