Results 1 to 14 of 14

Thread: [RESOLVED] Lock mapped drive letter

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,513

    Resolved [RESOLVED] Lock mapped drive letter

    Just installed some of my apps for a client on a newly installed Windows server 20008 system. Then network tech mapped me a "J:" drive and they run fine.

    The problem is if a workstation is rebooted and there is a USB device connected it can take the "J:" and then theres a problem.

    It seems there should be some way to prevent this, like by locking the mapped drive to the server. But, the network tech didn't know how. So I thought I'd ask. If anyone can point me to some good resources on this subject I'd appreciated it.

    Thanks

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Lock mapped drive letter

    If it is available the operating system itself will take the drive letter.

    I don't know what language your front end it written in, but what does your program map its own drive from the list of available driver letters on the machine? This may vary from machine to machine, but the actual drive letter really isn't that important as long as you have the drive mapped to something.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Lock mapped drive letter

    Not much of a technician... there's two ways, one is through a logon script... the second is when you go through the Map Drive wizard, on the last step there is a checkbox "Reconnect at Logon"...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Lock mapped drive letter

    Quote Originally Posted by techgnome View Post
    Not much of a technician... there's two ways, one is through a logon script... the second is when you go through the Map Drive wizard, on the last step there is a checkbox "Reconnect at Logon"...

    -tg
    Exactly - the issue is usually the other way around, with a USB drive not showing up because a mapped drive has taken the letter it was trying to get (which you can fix by launching diskmgmt.msc and re-assigning the USB drive to an unused letter).

    PS there is actually a third way - via Group Policy
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Lock mapped drive letter

    Better still... NEVER, EVER, rely on a mapped drive. Use a UNC, or just don't use the network resource if you can help it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,513

    Re: Lock mapped drive letter

    Thanks for all the replies,

    I put the database on the server so it can be accessed from mutliple workstations.

    techgnome,
    Don't know anything about "UNC" but will research it. These apps where never meant to be Multi user or on a server.

    thanks again for the replies

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Lock mapped drive letter

    Mapped Drive = "j:\foldername\folder\"

    UNC = "\\ServerName\foldername\folder\"

  8. #8
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Lock mapped drive letter

    A UNC path is what a map drive 'maps' to. When you share a folder on a server, you can then access that folder via a UNC path from another machine by specifying the server name and the share name. So for example if you had a server called MyServer and on there you shared the following folder D:\Data\SomeFolder\SomeSubFolder and you specified the share name as "MyShare" then the UNC path for that would be \\MyServer\MyShare and as you can tell, the UNC path is based purely on the share name, not the actual path to the folder that was shared.
    You can either map a drive to this path, or you can just use the UNC path on its own to access the data - if you just go to the Start Menu and then click Run, then you can type a UNC path into there and it will open up the contents of that share in explorer, in exactly the same way that it would if you opened a mapped network drive from My Computer. A mapped drive is just basically a way of creating a shortcut to a UNC path The only thing is that some programs do not like UNC paths and insist on having a mapped drive - which is a pain, but most modern programs are fine with UNC paths.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  9. #9

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,513

    Re: Lock mapped drive letter

    Great replies,

    So if my current code is,
    Code:
    cPath = "j:\aquadata\"
        conDB = "j:\aquadata\water.mdb"
        conCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & conDB
        conWater.ConnectionString = conCnn
        conWater.Mode = adModeReadWrite
        conWater.CursorLocation = adUseClient
        conWater.Open
    Then I could change it to, (if "SeverName" where the name of the server)
    Code:
    cPath = "\\ServerName\aquadata\"
        conDB = "\\ServerName\aquadata\water.mdb"
        conCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & conDB
        conWater.ConnectionString = conCnn
        conWater.Mode = adModeReadWrite
        conWater.CursorLocation = adUseClient
        conWater.Open
    Then there should be no problems if the workstation is connected to the server?

    thanks

  10. #10
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Lock mapped drive letter

    maybe... maybe not.... you need to find out what J: pointed to... it doesn't usually point to a server, but a shared folder on that server... so if it pointed to j:\aquadata .... then the unc should be \\yourserver\sharename\aquadata\water.mdb Unless you file is directly in the "root" of J: ... in which case, then yes, you unc would work fine.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  11. #11

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,513

    Re: Lock mapped drive letter

    techgnome,
    The tech created a folder on the server name "aquadata" and mapped it as "J:". Then created a sub folder call "aquadata". This is where the data is located. So if I understand you, this is what the UNC path is,
    Code:
    cPath = "\\ServerName\aquadata\aquadata\"
        conDB = "\\ServerName\aquadata\aquadata\water.mdb"
        conCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & conDB
        conWater.ConnectionString = conCnn
        conWater.Mode = adModeReadWrite
        conWater.CursorLocation = adUseClient
        conWater.Open
    thanks

  12. #12
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Lock mapped drive letter

    Yeah that would be correct, though I dont know if you can specify UNC paths for the Data Source part of a connection string... give it a go and see what happens

    EDIT: From the later posts in this page it looks like you can http://www.pcreview.co.uk/forums/thread-2407898.php
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  13. #13

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,513

    Re: Lock mapped drive letter

    chris128,
    Thanks. I sure hope it works in the connection string, thats where I need it the most. I will be going back on-site next week, I'll give it a try.

  14. #14
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Lock mapped drive letter

    wes - yes, then that would be the correct UNC path.
    chris - you betcha... been doing that since the days of VB4... as long as the user has Read AND write permissions to the folder, it works just fine.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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