Link to home
Start Free TrialLog in
Avatar of CyberUnDead
CyberUnDead

asked on

ASP.NET Access MDB "Exclusive" / "Read Only"

I have an issue where I have a split Access database that is accessed through both an Access front-end and a ASP.NET 2.0 web application.   The database back-end resides on the web server and the Internet Guest account along with ASPNET account have full permission under the folder security.  The ASP.NET 2.0 application accesses the Access database through an ODBC connection.  On initial setup or after a server reboot everything works fine but the moment the web application is used (i.e. someone logs in) the Access front-end gives the user a 3073 error.  The error states this query must be updatable which translates to the fact that a process of the web application has placed the db in exclusive "read-only" mode.  If one trys to open the Access database directly on the web server the "This is in read-only" message appears.  

My question how do I stop the web application (either IIS/ODBC or something else) from making the database read-only for all my other clients?  I know this a configuration issue because I have this same setup working at a different site without this issue.
Avatar of Solar_Flare
Solar_Flare

are you using OLEDB to open the database? if so then you can try setting the Mode in the connection string to not open it exclusively.



from http://msdn.microsoft.com/en-us/library/aa140022.aspx

Mode

A Long value (read/write) that specifies a bitmask that indicates access permissions. When read from
the Properties collection, the value returned is a number. When using the Mode property of the Connection object, you can use built-in constants, such as adModeRead. The Mode property can be one of the following values:

   Read-only (adModeRead)   1

   Write (adModeWrite)   2

   Read/Write (adModeReadWrite)   3

   Share Deny Read (adModeShareDenyRead) (Prevents others from opening in read mode.)   4

   Share Deny Write (adModeShareDenyWrite)
(Prevents others from opening in write mode.)   8

   Share Deny Exclusive (adModeShareDenyExclusive)
(Prevents others from opening in read/write mode.)   12

   Share Deny None (adModeShareDenyNone)
(Neither read nor write access is denied to others.)   16
Avatar of CyberUnDead

ASKER

To Solar_Flare

The web application is using an ODBC data connection. (i.e. Imports System.Data.ODBC)  future design hopefully will allow it to use more of a DAL with ODBC as one option of many data connection types.  Unfortunately right now it is limited to just ODBC.

I am thinking this is more of server/web server setting that needs tweaked.  I guess that could relate to some specific setting in the web.config.
ASKER CERTIFIED SOLUTION
Avatar of Solar_Flare
Solar_Flare

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To Solar_Flare

I am using an web.config file for my connection strings.  It takes the following current form:

<add name="DB" connectionString="DSN=DB" providerName="System.Data.Odbc"/>

So I should try?

<add name="DB" connectionString="DSN=DB" providerName="System.Data.Odbc" Exclusive="0" />
I was a little unsure of the syntax but I came across this site: http://www.webcheatsheet.com/ASP/access_connection_strings.php.

So the proper form should be:

<add name="DB" connectionString="DSN=DB; Exclusive=0" providerName="System.Data.Odbc"  />
This got me on the right track.
The solution Solar_Flare provided got me on the right track.  It turns out the "Network Service" account needed read/write permission on the database folder.  I was able to use Microsoft's/SysInternal's FileMon to track down the offending file locker.