Error :- The Microsoft Access database engine cannot open or write to the file. It is already opened exclusively by another user, or you need permission to view and write its data.

Background

Debugging an application and thankfully I have managed to add good exception handling.

Error

Here is the error message :-

Error Image

err_20181203_0532PM

Error Text


Attempt to connect to Provider = Microsoft.ACE.Oledb.12.0;User ID = Admin;Data Source=\\hrdb\payroll\payroll.mdb failed.
Exception Type is System.Data.OleDb.OleDbException
Exception Message is The Microsoft Access database engine cannot open or write to the file '\\hrdb\payroll\payroll.mdb'. It is already opened exclusively by another user, or you need permission to view and write its data.
Error Code is -2147467259
Error Source is Microsoft Access Database Engine
Error Inner Exception is
Stack Trace is at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at intc.svc.timer1_Elapsed(Object sender, ElapsedEventArgs e) in C:\\Service1.cs:line 339

Remediation

I watched the connection string over and over.  Installed the Database Connectivity driver and no good.

Finally, I accepted the error message.

Error Message :-

The Microsoft Access database engine cannot open or write to the file ‘\\hrdb\payroll\payroll.mdb’. It is already opened exclusively by another user, or you need permission to view and write its data.
Error Code is -2147467259.

The keyword is need permission to view and write.

The contextual user did not have the permission needed.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s