using Access database on network share?

Discussion in 'ASP .Net' started by Scott Nicholson, Nov 5, 2004.

  1. 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.
    Scott Nicholson, Nov 5, 2004
    #1
    1. Advertising

  2. Scott Nicholson

    Scott M. Guest

    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.


    "Scott Nicholson" <> wrote in message
    news:cmg9d2$e17$...
    > 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.
    Scott M., Nov 5, 2004
    #2
    1. Advertising

  3. Scott M. wrote:
    > 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?
    Scott Nicholson, Nov 5, 2004
    #3
  4. Scott Nicholson

    Scott M. Guest

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


    "Scott Nicholson" <> wrote in message
    news:cmgesh$ik2$...
    > Scott M. wrote:
    >> 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?
    Scott M., Nov 5, 2004
    #4
  5. 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

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net



    "Scott Nicholson" <> wrote in message
    news:cmg9d2$e17$...
    > 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.
    Steve C. Orr [MVP, MCSD], Nov 6, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Roszko

    Access Network Share with ASP.NET

    Steve Roszko, Oct 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    773
    Steve Roszko
    Oct 22, 2003
  2. Andrew Shitov

    How to access a network share folder?

    Andrew Shitov, Sep 13, 2004, in forum: ASP .Net
    Replies:
    9
    Views:
    22,980
    GrantMagic
    Sep 13, 2004
  3. Yuriy Galanter

    Access network share from ASP.NET

    Yuriy Galanter, Mar 10, 2008, in forum: ASP .Net
    Replies:
    4
    Views:
    1,859
  4. Jerry C
    Replies:
    5
    Views:
    731
    Alexey Smirnov
    Apr 24, 2008
  5. Saraswati lakki
    Replies:
    0
    Views:
    1,271
    Saraswati lakki
    Jan 6, 2012
Loading...

Share This Page