Results 1 to 15 of 15

Thread: [RESOLVED] UNC path

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Resolved [RESOLVED] UNC path

    Hi gurus

    I am working on VB6 and an access database, I am using the following UNC to connect to my database but for some reason it does not work, comes back with a "path is not correct" error.

    here is my connection string

    "connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\servername\folder\databasename.mdb"



    Thanks a bunch for any help I can get .

  2. #2
    Fanatic Member
    Join Date
    May 2007
    Location
    Merced
    Posts
    868

    Re: UNC path

    I'm not sure how to use databases sorry I cant be of help.

  3. #3
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: UNC path

    Quote Originally Posted by GDOG34
    I'm not sure how to use databases sorry I cant be of help.
    If you don't know the answer, don't answer.
    "connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\servername\folder\databasename.mdb"
    Maybe ; missing at the end? or maybe because you are using relative path, did you try with fixed path? like "C:\Dir\MyDb.mdb"
    Last edited by jcis; Sep 17th, 2007 at 07:08 PM.

  4. #4
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: UNC path

    Are you actually using \\servername\folder\????

    That will never work unless you have a server named "servername" and a shared folder on that server named "folder" and the database is in that folder. Use the actual names for the devices.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Re: UNC path

    Thanks gurus.
    R.
    I am actually using the correct servername and the correct folder on the server which is on the c drive.

    I have the folder on the server but is not shared, why does it has to be shared for UNC to work, I will check into it?

    J
    Yes, when the connection is local "c:\folder" it does work fine, is when I have the database on a server and the connection is through the LAN that the connection does not work, I tried with the "; " at the end and the error still the same.

    D

    Thanks anyways


    Thanks gurus for battling with me

  6. #6
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: UNC path

    Quote Originally Posted by GUARO
    I have the folder on the server but is not shared, why does it has to be shared for UNC to work...
    Because you need to have permissions setup - no one can access your drive (or folder within it) unless authorized.
    Basically the same (but more even restrictive) goes for actual servers - you can have permissions setup on a single file.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Re: UNC path

    R.

    Thanks for battling with me here

    The folder has the right permissions setup but the folder is not shared, if that is what you mean, I must be missing something because I still dont see the reason for sharing the folder in order for UNC to work but I will give a try at this point

    Thanks again

  8. #8
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: UNC path

    See this article: Connecting to an Access DB on a Server
    From there: "..the directory where the file is located needs to be mapped as a network drive on your computer."

    EDIT: ..But don't declare/instantiate the Connection like in that article, do it like this..
    Code:
       Dim lCon As Adodb.Connection
    
       Set lCon = New Adodb.Connection
       'F:\ is the shared folder mapped as a Network Drive
       lCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\MyDB.mdb"
       lCon.Open
    Last edited by jcis; Sep 17th, 2007 at 09:33 PM.

  9. #9
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: UNC path

    Well even if you map a drive to the folder, it still needs to be shared... or the drive needs to be shared.

    That is how the security works...

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Re: UNC path

    J

    Thanks for that articule and the help.- but this mapping does not make it any easier when you have 25 user to deploy the app. then you need to create 25 mapping on each computer to work.

    Is there another way for UNC to work on access database that you may know.

    Thanks again to all.

  11. #11
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: UNC path

    You CANNOT access someone else's computer unless you go thru security. It does not matter if you like it or not that is the way it is done and for good reason.

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    [ RESOLVED]Re: UNC path

    Thanks all for your help,

    Even thu the folder had the right permissions, in order for UNC to work the folder has to be shared.

    Thanks a bunch again gurus

  13. #13
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: [RESOLVED] UNC path

    Not only shared but ensure that any user has write, create file, modify file, delete file for any folder that they will access an MS Access database in. Remember the user needs to create the lock file (.ldb) if it doesn't exsist and alos delete if they are the last person in and leave.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  14. #14
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: UNC path

    Quote Originally Posted by GUARO
    J
    when you have 25 user to deploy the app. then you need to create 25 mapping on each computer to work.
    Incorrect.
    1 drive mapped on each computer. The idea is: there is a computer(Server) with the database and the Clients connect to it.

  15. #15
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: [RESOLVED] UNC path

    Mapping drives for data access is dangerous - drive letter can simply be taken already, user may disconnect it and map it back but link to a different letter ... and so on ...
    Long, story short - using UNC is much safer approach for file based db (such MS Access).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width