Every once in a while on my intranet application I get Database errors.
MS SQL Server will throw an error that the transaction was deadlocked.
It happens around a piece of code in which I have 2 queries, an Update and a
Delete which are nested inside a CFTransaction.
It also happens on another application that we use here at work.
On this page, the only thing happening is an update query. I checked the
date and time that the error occurred and I did not find 2 competing
transactions, so I was completely baffled as to why a SQL deadlock would
occur on a page where this just a single query.
What I have done is put a CFLock around this, in the hopes that this will
eliminate this error.
Does anyone have any experience with this?
If there are 2 users and they are not hitting the same table, but just
hitting the same database, could a deadlock situation occur?
This is the SQL Error I get:
ODBC Error Code = 40001 (Serialization failure)
[Microsoft][ODBC SQL Server Driver][SQL Server]Transaction (Process ID 71)
was deadlocked on lock resources with another process and has been chosen as
the deadlock victim. Rerun the transaction.
Thanks,
Ali
The main question is: Is it ok to put a CFLock around one or more cfqueries
that are nested in a Cftransaction.
E.G.:
<cflock>
<cftransaction>
<cfquery name="q1">
update table1
yadda yadda.......
</cfquery>
<cfquery name="q2">
delete table1
where ......
</cfquery>
</cftransaction>
</cflock>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:277354
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4