Re: Couldn't Lock File Error




"C Holmes" <CHolmes@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3E5E3E11-8D78-44B2-AA81-2C464A107500@xxxxxxxxxxxxxxxx
Good Morning All,

I have a VB App which is deployed onto a number of client PC's. The app
connects to an Access database located on the network. On occassion the
error
"Couldn't lock file" is raised (Err.Num -2147467259). I assume that this
would be related to 2 apps trying to hit the database at the same time. I
know that Access isn't the best option for this situation, but it's all
I've
got at this time.

I am trying to figure out the best way to handle this error.

I could have the program execute the statement again, but that just might
raise the same error again since they both initially started around the
same
time.

Or should I try to have the app re-execute the statement, but first use
the
Sleep function to have the app wait a random amount of time so that
hopefully
the 2 apps won't clash again. And then if that were to fail just throw up
a
msgbox "Couldn't connect to database. Try again", and leave it up to the
user
to try again.

Appreciate any input and ideas.
Thanks.

[What follows is likely a highly unsatisfactory reply. <g>]

MSAccess is a file-based database. There is no central manager (database
server) and therefore is subject to all the problems any shared file is
likely to have that is constantly being chewed on from multiple engines
across a wire. There is a lot of redirection between what any particular Jet
engine might logically request and how the OS/NTFS will service that request
and everyone else's.

Today's file servers are so sophisticated that we take it for granted that
every action will be performed flawlessly. Unlike a just a few years ago
when we were thrilled if our app even connected to the network. <g> Thus we
tend to ignore building in the safeguards that were commonplace and required
in the 'old days'.

I believe a simple delay mechanism as you suggested is likely to work most
of the time. However, a particular Jet engine can become confused at times.
The message might be more of a warning that something more than just a
temporal problem is being experienced. I have found that building a
behind-the-scenes (thus transparent) complete close-down of the
engine/connection and a reconnect to be useful for the health of a mdb.

If the problem comes more severe you might consider the creation of a
Gate-Keeper and/or utilize COM+ services to logically queue requests.

hth
-ralph


.



Relevant Pages

  • Re: Webservices - the way to go...?
    ... about your lack of secure network connectivity your between a rock and a ... To summarize the posts so far: you have a winform app. ... using a webservices data layer to handle all the database interactions. ... Upgrade your database to SQL Server. ...
    (microsoft.public.dotnet.general)
  • Re: .NET new executable
    ... Since there is no network access avaialble, I want to send my app to each ... then you update the data into database. ... If all you are trying to do is send some data to your SQL server, ...
    (microsoft.public.dotnet.general)
  • Re: Portable Database Choice
    ... I searched this group quite a bit looking for database alternatives and did find the options below from this search. ... I'm posting this in the hope it can be of use to other developers in a position similar to mine where I needed a low cost alternative to Pocket Access. ... One app requires synchronization between desktop and mobile device, the other requires a push of data from the desktop to mobile. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Portable Database Choice
    ... > database alternatives and did find the options below from this search. ... One app requires ... > push of data from the desktop to mobile. ... > Both of these apps used Pocket Access on the device with Peter Foot's ...
    (microsoft.public.dotnet.framework.compactframework)
  • Portable Database Choice
    ... database alternatives and did find the options below from this search. ... of data from the desktop to mobile. ... The read-only app requires speedy lookup of data in a flat table ... Both of these apps used Pocket Access on the device with Peter Foot's ...
    (microsoft.public.dotnet.framework.compactframework)

Quantcast