Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection to Access database

Status
Not open for further replies.

CoolMama

Programmer
Jan 19, 2006
50
US
I see there is already a thread on this, but no answer. SO I thought I'd present my version of the problem.

I build an intranet ASP.NET page using Web Matrix and IT connects to an Access database. When I try to view the page through the intranet, I get a permissions error (see below). The questions you guys have previously asked, I have already checked on:

1) What authentication mode have you set in your web.config file? (I used "Windows")
2) Are you allowing anonymous access in IIS?
3) Have you set the relevant security permissions on the folder?
4) Have you set the relevant sharing permissions on the folder?


This is my web.config file:

Code:
<configuration>
	<appSettings>
		<add key="MM_CONNECTION_HANDLER_policies" value="default_oledb.htm" />
		<add key="MM_CONNECTION_STRING_policies" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Edserver\web\RISB_SITE\policies.mdb;Persist Security Info=False" />
		<add key="MM_CONNECTION_DATABASETYPE_policies" value="OleDb" />
		<add key="MM_CONNECTION_SCHEMA_policies" value="" />
		<add key="MM_CONNECTION_CATALOG_policies" value="" />
	</appSettings>
    <system.web>
        <customErrors mode="Off" />
		<compilation debug="true"/>
		<authentication mode="Windows" />
    </system.web>
</configuration>




ERROR GENERATED THROUGH INTRANET...

Code:
Server Error in '/' Application. 
-------------------------------------------------------

The Microsoft Jet database engine cannot open the file '\\Edserver\web\RISB_SITE\policies.mdb'. It is already opened exclusively by another user, or you need permission to view its data. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.OleDb.OleDbException: The Microsoft Jet database engine cannot open the file '\\Edserver\web\RISB_SITE\policies.mdb'. It is already opened exclusively by another user, or you need permission to view its data.

Source Error: 

Line 11:             dbCommand.Connection = dbConnection;
Line 12:     
Line 13:             dbConnection.Open();
Line 14:             System.Data.IDataReader dataReader = dbCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
Line 15:     
 

Source File: D:\web\RISB_SITE\policies_PFF_alpha_test.aspx    Line: 13 

Stack Trace: 

[OleDbException (0x80004005): The Microsoft Jet database engine cannot open the file '\\Edserver\web\RISB_SITE\policies.mdb'.  It is already opened exclusively by another user, or you need permission to view its data.]
   System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
   System.Data.OleDb.OleDbConnection.InitializeProvider() +57
   System.Data.OleDb.OleDbConnection.Open() +203
   ASP.policies_PFF_alpha_test_aspx.myPolicies() in D:\web\RISB_SITE\policies_PFF_alpha_test.aspx:13
   ASP.policies_PFF_alpha_test_aspx.__DataBinddgPolicies(Object sender, EventArgs e) in D:\web\RISB_SITE\policies_PFF_alpha_test.aspx:109
   System.Web.UI.Control.OnDataBinding(EventArgs e) +66
   System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +10
   System.Web.UI.WebControls.BaseDataList.DataBind() +23
   ASP.policies_PFF_alpha_test_aspx.Page_Load(Object sender, EventArgs e) in D:\web\RISB_SITE\policies_PFF_alpha_test.aspx:20
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +750

 
The most likely cause of the problem is the way your app handles authentecation and delegation. Simply using Windows integrated security (with identity impersonate set to true) will NOT grant your application the proper network permissions for the user if things aren't configured properly. That's important if you're accessing a network resource, which it appears you are. This may help:

 
OK. I decided to go all the way back to basics. Rather than have Web Matrix or Dreamweaver generate the code, I created a database connection and data reader test using a text editor. Everything worked. So I guess now I just plug in the "code from scratch" into my final document and see if that fixes everything.

Thanks for your help! That was a quick response. I'll be back if I have more problems...with ASP.NET that is. [thumbsup2]
 
OK, I have my original file working fine...on the intranet server.

When I created the page in Web Matrix, it generated the DNS as:

Code:
Data Source=\\\\Edserver\\web\\RISB_SITE\\PFFOFF\\policies.mdb

...which works fine when run through the Web Matrix server.

But to run on my intranet, the DNS needs to be:

Code:
Data Source=D:\\web\\RISB_SITE\\PFFOFF\\policies.mdb

...but then it won't work on the Web Matrix server.

If I have to stay out of Web Matrix to make my pages work, that's fine. But I was wondering if someone knew why this was happening.

Dawn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top