|
-
July 15th, 2002, 02:00 PM
#1
DAO working from Windows App, but not Web App
In order to allow my C# Windows Application to use DAO 3.6, I include "Microsoft DAO 3.60" using the add references command, and add the following line to the source code:
I then put the following code, which establishes a connection to a database, into the main function:
PHP Code:
DBEngine myDBEngine = new DBEngineClass();
Workspace myWorkspace = myDBEngine.CreateWorkspace("ODBCWorkspace", "Admin", "", WorkspaceTypeEnum.dbUseODBC);
Database myDatabase = myWorkspace.OpenDatabase("MyDNS", DriverPromptEnum.dbDriverNoPrompt, true, "ODBC;");
This all works fine, and I can make recordsets and retrieve records etc.
Now I use exactly the same technique and code in a Web Application project, but this time I get the exception thrown "ODBC--call failed" on the OpenDatabase() call. I've tried ODBC tracing and found a more detailed error:
DIAG [S1000] [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data. (-1032)
The file is certainly not locked exclusively by another user, and so I must assume that there is permission problems. I've tried setting the IIS servers settings to minimum protection wherever possible - but still the same problem occurs. Weird eh?
Well I'm stumped on this one - so if any of the gurus could point me in the right direction, I'd be mighty grateful.
Rob Smith
-
July 15th, 2002, 03:00 PM
#2
Re: DAO working from Windows App, but not Web App
Originally posted by fatbuddha
In order to allow my C# Windows Application to use DAO 3.6, I include "Microsoft DAO 3.60" using the add references command, and add the following line to the source code:
I then put the following code, which establishes a connection to a database, into the main function:
PHP Code:
DBEngine myDBEngine = new DBEngineClass();
Workspace myWorkspace = myDBEngine.CreateWorkspace("ODBCWorkspace", "Admin", "", WorkspaceTypeEnum.dbUseODBC);
Database myDatabase = myWorkspace.OpenDatabase("MyDNS", DriverPromptEnum.dbDriverNoPrompt, true, "ODBC;");
This all works fine, and I can make recordsets and retrieve records etc.
Now I use exactly the same technique and code in a Web Application project, but this time I get the exception thrown "ODBC--call failed" on the OpenDatabase() call. I've tried ODBC tracing and found a more detailed error:
DIAG [S1000] [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data. (-1032)
The file is certainly not locked exclusively by another user, and so I must assume that there is permission problems. I've tried setting the IIS servers settings to minimum protection wherever possible - but still the same problem occurs. Weird eh?
Well I'm stumped on this one - so if any of the gurus could point me in the right direction, I'd be mighty grateful.
Rob Smith
I don't know much at all about DAO but it sounds to me like you're getting a permissions error. Doesn't the Web server run as user nobody? Could that be affecting your application?
Jared
-
July 17th, 2002, 08:50 AM
#3
Does the IUSR_ account have read/write access to the file? If not, that's probably your issue.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|