Problem accessing Access/Jet databse: Could not lock file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I've a problem (again ;-). On a PC I have an Access database in a shared folder (other users/pc's have read/write access)
On other PC's I have the problem that I get an exception saying "Could not lock file" while performing DataAdapter.Fill
But accessing the database with Microsoft Access (on a remote PC) is no problem at all. I can do everything

Has this anything to do with the "Database Locking Mode". What does that do? And which value does what

Thanks in advance

Best Refards

Michiel Doeven
 
Hi Michiel,

Is this an asp.net application?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Michiel Doeven said:
Hello,

I've a problem (again ;-). On a PC I have an Access database in a shared
folder (other users/pc's have read/write access).
On other PC's I have the problem that I get an exception saying "Could not
lock file" while performing DataAdapter.Fill.
But accessing the database with Microsoft Access (on a remote PC) is no
problem at all. I can do everything.
 
Set write access for aspnet_wp user to the folder where your access file is
located.

Michiel Doeven said:
Hello,

I've a problem (again ;-). On a PC I have an Access database in a shared
folder (other users/pc's have read/write access).
On other PC's I have the problem that I get an exception saying "Could not
lock file" while performing DataAdapter.Fill.
But accessing the database with Microsoft Access (on a remote PC) is no
problem at all. I can do everything.
 
Hi Michiel,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you received an error which says "Could
not lock file" when opening a connection to an Access database on a network
shared folder. If there is any misunderstanding, please feel free to let me
know.

Since the .mdb file can be opened using Access and everything can be done,
I think there might be something wrong with the way you open it in your
code. If you're using an OleDbConnection object, could you show us your
connection string? You can also try to use the following one:

Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=\\ServerName\Folder\Data.mdb;Mode=Share Deny None;Persist Security
Info=False

Please also check if the file has been opened by other users. If the file
is open, there will be a .ldb file with the same name as the .mdb file in
the same folder. If that file exists, please delete it and try to connect
again.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Well, the problem seems to occur on only one PC (not yet sure though)
I just assumed it was a problem on all remote PC's and so I checked opening with the Access with my laptop (and not with the PC that has the problem). Maybe the user has set some options on his PC
What I want to know is when this error occurs. It is raised when trying to fill a dataset with a dataadapter (so only reading). The database locking mode is already set to 1 (was hoping that solved the problem). So what are the other options to check

Thanks for your reply

Best regards

Michiel Doeven
 
Hi Michiel,

Since this problem happens only on one PC, I think there might have
something to do with the permission setting for the folder. We have to
check how the computer was authenticated when logging on to the remote
server. Please compare the settings on your laptop and the computer that
has problem. Please also try to check if you can open the .mdb file
directly using Access from the computer which was unable to connect.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top