golfnut1969 Posted September 15, 2004 Posted September 15, 2004 I'm currently running a web app using a SQL server connection. I'm using a core dll that is designed to connect to SQL or Access. When trying to connect to Access I'm getting the following error. OleDbException (0x80004005): Unspecified error] System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) System.Data.OleDb.OleDbConnection.InitializeProvider() System.Data.OleDb.OleDbConnection.Open() I've tested my connection string in a simple VB.NET windows app and it works fine. The connection I'm making above is made in a DLL written in C# and works fine if connecting to SQL Server databases. Any help would be greatly appreciated. Thanks Here is the basic code Dim cn As IDbConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Temp\MyAccessDB.mdb;User ID=;Password=;") cn.Open() Quote
Administrators PlausiblyDamp Posted September 15, 2004 Administrators Posted September 15, 2004 There is a good chance that this is a permissions error - a web application runs as a user on your system called ASPNET and this user will need permission to the c:\temp folder. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
golfnut1969 Posted September 15, 2004 Author Posted September 15, 2004 There is a good chance that this is a permissions error - a web application runs as a user on your system called ASPNET and this user will need permission to the c:\temp folder. When I tried to add ASPNET to the directory permissions I got this: An object named "ASPNET" cannot be found. Check the selected object types and location for accuracy and ensure that you typed the object name correctly, or remove this object from the selection. Quote
golfnut1969 Posted September 15, 2004 Author Posted September 15, 2004 Belay my last. I did get the permissions set for the folder to ASPNET (I had to add the computer name also eg. MyCompNm\ASPNET) However, this hasn't fixed my problem. Thanks for trying. Quote
bri189a Posted September 16, 2004 Posted September 16, 2004 If your Access database is on the server and your windows app connects to it on the server fine I'd say the third party tool has a problem or isn't being implemented correctly if the below doesn't solve it (probably the below and not the third party tool) You could always convert try to narrow down that exception to a specific message... throw in a catch OleDbExecpetion ex and then do ex.InnerException.Message, or convert the error code to a long with your calculator and look it up on google (I'll save you some time - Access Denied was the most popular result). Also the folder that has the database in it needs Read/Write permissions for ASPNET and Internet Guest Account...typically ASPNET and IWAM usually have Read and Execute permissions but do not have write. You might want to seriously think about having the database off your web root folder as on a server you wouldn't be allowed access to C:\Temp - you'd be allowed access to Server.MapPath(yoursite)\data\ though. Quote
golfnut1969 Posted September 16, 2004 Author Posted September 16, 2004 You might want to seriously think about having the database off your web root folder as on a server you wouldn't be allowed access to C:\Temp - you'd be allowed access to Server.MapPath(yoursite)\data\ though. I actually moved the database from the web root directory to see if that would help but it didn't. It was only in C:\Temp when I posted but I have since moved it back. I'll try some of your other suggestions and reply again later. Thanks Quote
golfnut1969 Posted September 16, 2004 Author Posted September 16, 2004 ...then do ex.InnerException.Message, or convert the error code to a long with your calculator and look it up on google (I'll save you some time - Access Denied was the most popular result). ex.InnerException is Nothing Error Code = -2147467259 Quote
Administrators PlausiblyDamp Posted September 16, 2004 Administrators Posted September 16, 2004 Is anything else using the .mdb file at the same time? I've seen this error code occur when a file is already in use. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
golfnut1969 Posted September 17, 2004 Author Posted September 17, 2004 No, the file exist in it's own folder and the lock file (.ldb) doesn't exist. I have connected to this same database with a Windows app written in VB and another in C#, both work. It is only when I try and connect to our the db from my web project. Originally I was trying to use our dll that we use as a core for all our projects. However since then I have tested opening the db with out using the dll (opening straight from the web app) and it fails as well. Quote
bri189a Posted September 17, 2004 Posted September 17, 2004 it's deffinitely permissions if you don't have a problem using the same thing with a windows app. Give the folder that the db resides in Everyone/Full control perms...see what that does. Quote
golfnut1969 Posted September 17, 2004 Author Posted September 17, 2004 it's deffinitely permissions if you don't have a problem using the same thing with a windows app. Give the folder that the db resides in Everyone/Full control perms...see what that does. I found the problem and it was permissions. I had to change a setting in the web.config file (<identity impersonate="false" />). When this value was true, the App was trying to impersonate a windows user, and this didn't work with access. I'm not sure if this setting is part of .NET or if it is part of our core dll. Thanks for all your help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.