[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
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.
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
Re: Lock mapped drive letter
Quote:
Originally Posted by
techgnome
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 ;)
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
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
Re: Lock mapped drive letter
Mapped Drive = "j:\foldername\folder\"
UNC = "\\ServerName\foldername\folder\"
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.
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
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
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
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 :D
EDIT: From the later posts in this page it looks like you can :) http://www.pcreview.co.uk/forums/thread-2407898.php
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.
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