Solved

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

Posted on 2008-06-12
7
1,240 Views
Last Modified: 2013-11-07
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.
0
Comment
Question by:CyberUnDead
  • 5
  • 2
7 Comments
 
LVL 15

Expert Comment

by:Solar_Flare
ID: 21773693
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
0
 

Author Comment

by:CyberUnDead
ID: 21774506
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.
0
 
LVL 15

Accepted Solution

by:
Solar_Flare earned 500 total points
ID: 21775191
does your connection string contain "Exclusive=1"? if so then that would cause it to be exclusive and block any other connections.

you could also try putting Exclusive=0 to forcibly make it non-exclusive.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:CyberUnDead
ID: 21779197
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" />
0
 

Author Comment

by:CyberUnDead
ID: 21795996
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"  />
0
 

Author Closing Comment

by:CyberUnDead
ID: 31466712
This got me on the right track.
0
 

Author Comment

by:CyberUnDead
ID: 21803072
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.
0

Featured Post

How does your email signature look on mobiles?

Do your employees use mobile devices to reply to emails? With mobile becoming increasingly important to the business world, it is in your best interest to make sure that your email signature looks great across all types of devices.

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now