using Access database on network share?

  • Thread starter Scott Nicholson
  • Start date
S

Scott Nicholson

I've got a site set up that uses a network share as it's home directory.
Simple stuff is working fine.

When I try to put a database in there, though, I run into problems.

I'm using:

dim dbconn,sql,dbcomm
dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data
source=" & server.mappath("test.mdb") & ";")
dbconn.Open()

And I'm getting a message:

Server Error in '/' Application.
Unspecified error
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: Unspecified error

Source Error:

Line 16: dim dbconn,sql,dbcomm
Line 17: dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
data source=" & server.mappath("test.mdb") & ";")
Line 18: dbconn.Open()

"test.mdb" is in the same folder as the .aspx file (maps to
\\omega\www\dir\test.mdb)

.... If I copy all the files to a local folder on the hard drive and
change the home directory of the site it works fine.

Is is not possible to use an access database on a network share? I can't
imagine that's the case.

Help is appreciated.
 
S

Scott M.

Is it not possible to use an access database on a network share?


Right. Access is not meant for multi-user activity anyway. If you must use
Access, locate it on the same machine as the web application.
 
S

Scott Nicholson

Scott said:
Is it not possible to use an access database on a network share?


Right. Access is not meant for multi-user activity anyway. If you must use
Access, locate it on the same machine as the web application.

I'd like to be able to edit this web application on both my desktop and
my laptop, so I've set a share on my fileserver as the home directory
for the site on both machines, and made the share available offline on
my laptop. This way I can edit the files on either machine, whether
connected to the network or not, and can preview the files on either
machine at http://localhost/

So the share is \\omega\www, and I've set that share as the home
directory of my website in IIS.

I've created \\omega\www\dir and put "test.mdb" in that dir, and created
db_test.aspx in the same dir that attempts to access the test.mdb file.

You're telling me this won't work?
 
S

Scott M.

I'm saying that Access OLEDB connection strings must point to a local
physical path. Server paths won't work.
 
S

Steve C. Orr [MVP, MCSD]

The default ASPNET user account doesn't have network permissions.
One solution is to change ASP.NET to run under a different account that has
the necessary permissions. For testing purposes I suggest having it run
under your user account since you know you have permission.

For example, you can add a line similar to this to your web.config file:
<identity impersonate="true" userName="domain\MyAppUser">
password="password"/>

Here's more info on impersonation:
http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,016
Latest member
TatianaCha

Latest Threads

Top