473,383 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

ODBC and Deadlock

hi,
i'm using linked table from access 2k to sql2k.

In a form delete event i do an update (rs.update and then rs.close) to
another table (let's call it "X") not the same where the form is linked
to.

I get a deadlock to the table "X" for those modified records.
I discovered that until i am in the delete event (debug mode) i can't
select records from table "X" neither from a Query analizer SQL.

Why this behaviour ?

Nov 13 '05 #1
4 4445
it seems that all the code within the delete event belong to an
implicit Transaction (made from Access i suppose).

Maybe this is due to the "cancel" parameter that is required from this
kind of event procedure ?

Nov 13 '05 #2
it seems that all the code within the delete event belong to an
implicit Transaction (made from Access i suppose).

Maybe this is due to the "cancel" parameter that is required from this
kind of event procedure ?

Nov 13 '05 #3
Sometime in the last 6 years, Jet transactions
were changed to prevent 'dirty reads'. You
can't read anything touched inside a transaction.

Access uses a collection of cached connections,
and each connection runs a separate transaction(!)

After you have touched the records, none of the
other connections can read the records until
the transaction is completed.

You have no control over which connection you
use, so you will always get spurious locks in
transactions.

Solutions are
(1) upgrade to A97/ Jet 3.51, which does not exhibit
this behaviour.

or
(2) use a different workspace, so that your database
action is not inside the implicit transaction.

set ws = application.dbengine.createworkspace
set db = ws.opendatabase(codedb.name)

(david)

"merco" <d.********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
it seems that all the code within the delete event belong to an
implicit Transaction (made from Access i suppose).

Maybe this is due to the "cancel" parameter that is required from this
kind of event procedure ?

Nov 13 '05 #4
Just my 2¢ worth, but when ever you are trying to manipulate data in a
Sql Server database through ODBC, more times than not - it leads to
complications such as what you are describing. A more reliable
technique for manipulating Sql Server database is to use ADO.

Ex:

Sub DelRecs()
Dim cmd As New ADODB.Command
cmd.ActiveConnection = &
"Provider=SQLOLEDB;Source=YourSqlServer;Database=Y ourSqlDatabase;UID=Ste
ve;PWD=Secret;"
cmd.TimeOut = 600 '--seconds that is - 600 seconds
'--- 10 minutes - for safety
cmd.CommandType = adCmdText
cmd.ComandText = _ &
"Delete From yourTable Where somefield = something"
cmd.Execute
cmd.ActiveConnection.Close
End Sub

This is way faster than doing it through ODBC, ODBC passthrough query.
The likelyhood of having contention issues using ADODB is greatly
reduced.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robert Brown | last post by:
I have a deadlock that's happening on one oracle instance but cannot be reproduced on any other. It is always caused by the same SQL statement colliding with itself and only happens under very high...
6
by: Anil Kumar Saharan | last post by:
Hi, I have a loopback connection using ODBC in the DLL initialization code of the SQL Server ESP Module (SQL Server 2000). The loopback connection works fine when the DSN is specifed with the...
7
by: Andrew Mayo | last post by:
Here's a really weird one for any SQL Server gurus out there... We have observed (SQL Server 2000) scenarios where a stored procedure which (a) begins a transaction (b) inserts some rows into...
3
by: Nigel Robbins | last post by:
Hi There, I'm getting a deadlock when I have two clients running the following statement. DELETE FROM intermediate.file_os_details WHERE file_uid = ? AND obj_uid There is a compound index on...
1
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here....
15
by: Zeng | last post by:
Hi, The bigger my C# web-application gets, the more places I need to put in the tedious retrying block of code to make sure operations that can run into database deadlocks are re-run (retried)...
1
by: Grant McLean | last post by:
Hi First a simple question ... I have a table "access_log" that has foreign keys "app_id" and "app_user_id" that reference the "application_type" and "app_user" tables. When I insert into...
0
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to...
0
by: mmones | last post by:
Hello, I 'm working with an IBM DB2 V9 database via ODBC/CLI. I've got a problem with different lock behaviour in the following constellation / configuration. 1) connection C1 and connection...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.