473,581 Members | 2,783 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tricky Record Locking Problems

I have a problem with record locking / blocking within an application.
The app is quite straight forward. Written in Delphi 5 using BDE to
access a SQL 7 database (Win2K server).

Every so often the users (when they bother to tell me) find that the
application locks up and they are unable to work. No errors are
produced (error trapping in the app is good). They 'shout round' to
each other and get someone to exit the data entry screen. This seems
to free up the locking/blocking issue.

There are about 50,000 records in the table (script below) and it is
accessed through a simple query (script below). All users will access
this in the same way. I'm assuming that a new record is being edited
when the problem occurs, but this shouldn't cause locking/blocking
until it gets committed (right ?).

The problem is tracking down the source of this and finding the
pattern which I can work back from. I've used Erland's aba_lockinfo
script (a few months back admittedly so will re-visit this), but
nothing obvious is jumping out at me.

No other tables should be in use at this point.

Any suggestions ?

Thanks

Ryan

/* Code for query component - users navigate to the record they need
to edit
there could be 15,000 records showing as outstanding - perhaps this
is the area that I need to re-visit so that less records can be edited
? */

SELECT *

FROM
PostReceived

WHERE
ToDelete = 0 AND
Completed <> 1

ORDER BY
PostID

/* Table in question */

if exists (select * from sysobjects where id =
object_id(N'[dbo].[PostReceived]') and OBJECTPROPERTY( id,
N'IsUserTable') = 1)
drop table [dbo].[PostReceived]
GO

CREATE TABLE [dbo].[PostReceived] (
[PostID] [int] IDENTITY (1, 1) NOT NULL ,
[Type] [varchar] (100) NULL ,
[ClientsName] [varchar] (100) NULL ,
[DateReceived] [datetime] NULL ,
[EnteredBy] [varchar] (100) NULL ,
[AssignedTo] [varchar] (100) NULL ,
[DateAssignedTo] [datetime] NULL ,
[Adviser] [varchar] (100) NULL ,
[TargetDate] [datetime] NULL ,
[CompletionDate] [datetime] NULL ,
[Completed] [bit] NULL ,
[KeyAccount] [varchar] (100) NULL ,
[Notes] [text] NULL ,
[Specific1] [varchar] (20) NULL ,
[Specific2] [varchar] (20) NULL ,
[Specific3] [varchar] (20) NULL ,
[Specific4] [varchar] (20) NULL ,
[Specific5] [varchar] (20) NULL ,
[ToDelete] [bit] NULL ,
[EnterUser] [varchar] (20) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Jul 20 '05 #1
3 5118
Ryan (ry********@hot mail.com) writes:
I have a problem with record locking / blocking within an application.
The app is quite straight forward. Written in Delphi 5 using BDE to
access a SQL 7 database (Win2K server).

Every so often the users (when they bother to tell me) find that the
application locks up and they are unable to work. No errors are
produced (error trapping in the app is good). They 'shout round' to
each other and get someone to exit the data entry screen. This seems
to free up the locking/blocking issue.

There are about 50,000 records in the table (script below) and it is
accessed through a simple query (script below). All users will access
this in the same way. I'm assuming that a new record is being edited
when the problem occurs, but this shouldn't cause locking/blocking
until it gets committed (right ?).
It depends on how Delphi handles the data. I don't know what access
methods Delphi uses, so I will talk in terms of ADO that I know at least
something about. Say that your application would get the data into a
recordset with a client-side cursor. In this case you should not get any
locking problems, because data is read once and then released.

But if you wuuld use a server-side cursor with perssimistic locking,
you would get blocking all over the place, because each user would
hold locks ons his data set, and no one else would be able to update.

There are a couple of variations on this theme. If the application
fails to commit an update, so the user clings to the locks, then
no user will be able to get any rows, because with the WHERE clause
of your query, it seems that a table scan is the only way to get the
rows, and thus SQL Server has to access the updated and locked rows
to see if they qualify. This particular situation you could overcome
with a READPAST hint. However, since we don't really know what is
causing the problem, it is difficult to tell.
The problem is tracking down the source of this and finding the
pattern which I can work back from. I've used Erland's aba_lockinfo
script (a few months back admittedly so will re-visit this), but
nothing obvious is jumping out at me.


Running it in a blocking situation could give some information of
what is going on. But in the end knowledge about what the Delphi
does is necessary.
--
Erland Sommarskog, SQL Server MVP, so****@algonet. se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
Sorry, ignore it. I spotted the problem. I left a copy of the table
open which I should have closed when the user entered that form. It
then locks the table, hence my problem.

Ryan
Jul 20 '05 #3
Erland, thanks for the reply, I managed to post mine before I saw
yours. The aba_lockinfo SP really helped me (once I re-visited it). I
used it whilst trying various things out with while debugging the app
and eventually found one particular way of getting into the data entry
screen wasn't doing what I wanted it to do (under a specific
scenario). By using your sp, I watched what happened on the server and
found where the problem was. I could reliably re-create the problem. I
fixed it and tested with the sp, and it seems to have done the trick.
Once again, thanks.
Jul 20 '05 #4

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

Similar topics

1
1671
by: jv | last post by:
Hello, I'm using A2K and am trying to make sure that my program only locks one record at a time and I don't seem to have any luck getting that to happen. In the database options, I've selected "Open Database Using Record-Level Locking" and the default record lock setting is "Edited Record". My forms' record lock setting is also "Edited...
2
1678
by: pj | last post by:
We are experiencing record locking errors which don't make sense. O/S :Windows 2003 Server running Terminal Services Access 2003 SP1 Front end copied to each user folder. 4 users adding records in same area of program but in different records get a conflict message asking to Save/Copy to Clipboard/Don't Save (I've seen this message on a...
22
18782
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4. The system is client/server, multiusers based. The MDBs are using record locking. Here is part of the code: Dim wkSpace As Workspace, db As...
5
8819
by: payffl | last post by:
My users are running Access '03. They have a database with a form that allows them to enter new records. Frequently they will move to a new record and not enter any information. This prevents the record from writing to the table, and worse, it prevents anyone else from opening the database (db has been placed in a state by user....etc.) ...
0
4094
by: Cindy Huyser | last post by:
I have an Access 2000 database behind a threaded Java application that that can have have concurrent access to the same table (but not the same record). The database is set up for shared access with "No locks" as the default, so that optimistic record locking should take place, and "Open databases using record-level locking" is selected. Each...
3
1866
by: David C. Barber | last post by:
How do you lock a record in SQL Server from ASP 2? I need to read the record, allow the user to edit it, and then have them click Save and rewrite it. Obviously I don't want anyone else getting into this record while the user has it up. I don't see how to have SQL Server lock this record for me since the connection drops the moment the page...
6
2665
by: jsacrey | last post by:
Hello everybody, I've got a bit of a situation that I could use some guidance with if possible. I work for an auditing firm where my users audit electronic shipping data for customers to see if they've been overcharged for shipments by truck and rail carriers. 99.9% of the time, one of our auditors needs to see all data sent by a...
0
1985
by: Andy_Khosravi | last post by:
I'm having issues with updates being blocked due to some sort of record locking issue. The error does not occur consistently, so I've had a hard time nailing it down. It does happen enough to cause major problems for my users though as they are working in this all day. I've been pounding my head against the wall for the last week trying to get...
1
2222
by: Paul H | last post by:
I have an Employees table with the following fields: EmployeeID SupervisorID Fred Bob Bob John Bob Mary Bill Bill I have created a self join in the relationships window, with
0
7876
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7804
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7910
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3809
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3832
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1144
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.