Forum Moderators: open

Message Too Old, No Replies

Cant make a OLE DB database connection across a network

error: File is already opened exclusively by another user, ....

         

swerver

3:56 pm on May 20, 2005 (gmt 0)

10+ Year Member



Help,
I've got a dotnet application running on a Win 2000 server, IIS 5.0 and asp.net 1.1. Most of this app is backed by SQL Server 2000. But I am forced to pull some information from a myriad of MS Access databases located on another server. The only way that I know how to do this is by simply using the mapped network drive in the OLE DB connection string to these Access databases.

To test this theory, I created a folder on the remote machine and stuck a “test” Access database in it. I gave every permission I could think of to this folder and database; ie everyone, system, etc, etc. However, nothing I try seems to work. Every time I try to view my app in a browser, I get the error:

The Microsoft Jet database engine cannot open the file 'P:\myfolder\mydb.mdb'. It is already opened exclusively by another user, or you need permission to view its data.

The problem seems to be entirely related to the network. Point to an exact copy on the local machine and everything works fine. The test database is not open or locked. No workgroup has been assigned to it.

From the information I’ve found, it seems this error is caused by security and sharing issues. But, as I’ve said, I’ve tried to give every permission and share I could think of to the test folder and database. Nothing works short of moving everything to the same machine. I did get this one bit of advice from someone,

“When your code executes inside IIS 5.0, it's running as the 'ASPNET' user account, which only exists on that local machine. Chances are the share does not have permissions defined for this user. The only way I know of to get this to work is to set the two machines up in the same domain and use impersonation/delegation to let the code running as the ASPNET user pretend to be a domain user that has the authority to access the share.”

…but none of this makes sense to me.

Can anyone who has experienced this please walk me through the steps to getting this thing to work across a network. I have got to figure it out somehow……………!

Many thanx

gregpakes

10:39 am on May 22, 2005 (gmt 0)

10+ Year Member



You should make sure that the ASPNET account has permission to the folder that the access database is located in.

You can *test* this by simply setting the NTFS security permissions. You can TEMPORARILY allow the group 'Everyone' to have full access. THIS SHOULD BE REVERTED BACK AFTER AND APPROPRIATE SETTINGS APPLIED.

swerver

7:44 pm on May 22, 2005 (gmt 0)

10+ Year Member



Nope, that doesn't work because the app and the databases are on two different boxes.

The ASPNET account refers to the .net service on the local box........I tried that one

gregpakes

8:37 pm on May 22, 2005 (gmt 0)

10+ Year Member



well - you need to get the other box to allow the account from the webserver box.

I think you might have to impersonate a user account from the box with the database on.

You can set fixed identities for specific virtual directories by using the following setting in web.config.

<identity impersonate="true" userName="YourAccount"
password="YourStrongPassword" />

I am not 100% as I have not tried it, but give it a go.

swerver

8:56 pm on May 22, 2005 (gmt 0)

10+ Year Member



I messed around with impersonation but couldn't get anything to work. But I think you're on track with the other part: getting the boxes to talk to each other.

But Im no server guy. How does one set permissions and such to accounts on another box? I cant seem to figure it out. To me, it all seems local.........

gregpakes

10:57 am on May 23, 2005 (gmt 0)

10+ Year Member



If you are on a domain you can set domain accounts to have access to certain directories and then run your webserver using the domain account.

You can however create a local account on each computer with the same accountname and password. you give this account the appropriate permissions to the folder containing the database. You then configure your website to browse anonymously using this account.

This should work. But a little messy.