2

I have a window application which tries to connect a MS Access file which is all ready used by another application. When I stop that application then I am able to connect with MS Access file. Otherwise an error occurs as follows:


OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "AccessDb" returned message "Cannot start your application.
The workgroup information file is missing or opened exclusively by another user.

Is there any way which I can open a connection in read only mode. I have to just read data from that file.

Thanks.

Yahia
  • 69,653
  • 9
  • 115
  • 144
शेखर
  • 17,412
  • 13
  • 61
  • 117
  • 1
    I faced this problem once, and found there's no way to work around. The problem may be of the opened application accessing exclusive into the Access file. You can refer to this link: http://social.msdn.microsoft.com/forums/en-US/adodotnetdataproviders/thread/31f75deb-ed3f-40e8-8084-ce51343b05cf – Thinhbk Feb 03 '12 at 09:37

2 Answers2

5

Try adding "Mode= Share Deny None" to the connection string of this application that is locking the DB, so that the connection string looks like

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyFolder\MyDb.mdb;Persist Security Info=False;Jet OLEDB:Database Password=My_Password;Mode= Share Deny None

This connection string should be used by the application that is currently opening the DB in exclusive mode.

Max
  • 7,408
  • 2
  • 26
  • 32
  • another exception saying:The Microsoft Office Access database engine cannot open or write to the file '\\172.16.24.37\ACServer\ACCESS.mdb'. It is already opened exclusively by another user, or you need permission to view and write its data. My connection string is – शेखर Feb 03 '12 at 08:44
  • 2
    your connection string is ok, the issue is that the file is already opened in exclusive mode by another application: is this other application that cause the issue, and is this other application that need to be fixed. If this other application open the database in exclusive mode, you cant open the DB, and you can do nothing about it. Someone need to change the other application to make it open the DB in shared mode instead that exclusive mode. – Max Feb 03 '12 at 09:48
  • No need for the `Mode= Share Deny None` part. Just `Jet OLEDB:Database Password=My_Password` is enough – Ghasem Aug 01 '15 at 07:27
0

I was facing similar problem and it's solved now. In connection String u might have provided Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\serverName\shareName\folder\myDatabase.mdb;User Id=admin;Password=;

Don't provide Password and instead while sharing file click on advanced sharing and remove administrators users and add everyone with full control. then run your application