Re: Could not update; currently locked error
- From: S Haney <SHaney@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 16 Apr 2008 16:49:01 -0700
Just out of curiosity...did you double check the level of locking that you
set for your database? I only ask because it seems that if one thread will
execute (update or insert a record) properly on the same table the other
thread will not (even though both are updating / inserting a different
record) that the problem is that you set the table to lock when a record is
getting updated instead of using record-level locking.
Just a thought :)
"Andriy" wrote:
Hello Bob,.
Thank you very much for your reply.
Definitely permissions are not the problem because I see the .ldb file being
created, modified and deleted.
If I understand right if Jet is single-threaded I can synchronize my threads
in C++ without any loss in performance because it is synchronized somewhere
between ADO and Jet anyway.
I am not quite understand how the switching of ADODB from apartment-threaded
to free-threaded may help me to prevent the lock error. Could you explain me
please?
I wonder if there any way to tell Jet to wait and retry again if a record is
locked?
Unfortunately I have to leave and cannot answer you right away.
Thank you very much in advance,
Andriy
"Bob Barrows [MVP]" wrote:
Jet is single-threaded, but, if permissions are not the problem, you
should be seeing the .ldb file being created, modified and deleted while
your application is working. Do you? If not, then permissions is the
problem.
ADODB is apartment-threaded by default. You might try switching it to
free-threaded by using the makfre15.bat file in the ...\program
files\common files\system\ado folder. Maybe that will help too.
Otherwise, you will need to catch and handle the error.
Andriy wrote:
Hello Bob,
Thank you very much for your reply.
I don't think this is a permission problem. My test application runs
2 threads which are waiting on the same event. When I pulse the
event, each thread opens its own connection to the same db file and
executes update statement on its own record in the same test table.
As far as I understand both threads run with the same user
permissions because I do not specify any security attributes for
threads. Nevertheless one of the threads succeeds, and another one
fails. The same thing happens when the threads execute insert
statements.
Do you have any idea what connection properties should I look for?
Should I look for ADO properties or Jet OLEDB provider properties?
Thank you very much in advance,
Andriy
"Bob Barrows [MVP]" wrote:
Andriy wrote:
Hello,Assuming the database is not marked Read-Only or resides on a cd,
I run a C++ test program that updates records in MS Access database
(mdb file) from different threads. I use ADO to access the database.
As far as I understand the underlying provider is MS Jet OLEDB. I
get the following error: Code = 80004005
Code meaning = Unspecified error
Source = Microsoft JET Database Engine
Description = Could not update; currently locked.
I do not understand why I get this error even when I insert records
or update different records. Is there any way to tell ADO/Jet not to
produce error but wait till records are unlocked?
this is most likely a permissions problem. In order for multi-user
activity to be supported, all users of the database file need to be
able to create, modify and delete a locking file (.ldb) in the
folder containing the database. Users need Modify permissions for
that folder, not just the database file.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
- Prev by Date: Re: Forward-only recordsets
- Next by Date: Re: Forward-only recordsets
- Previous by thread: Forward-only recordsets
- Next by thread: database connectivity vb-sql
- Index(es):
Relevant Pages
|