Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: DBMS and network drive

by tokpela (Chaplain)
on Aug 01, 2009 at 13:19 UTC ( #785092=note: print w/ replies, xml ) Need Help??


in reply to DBMS and network drive

This is pretty easy really - you just open the file using the UNC.

Basically, opening a file on a network drive can be accomplished by using the UNC filepath:

my $unc = '//10.1.0.22/path/to/use'; open(my $fh, $unc) or die "[Error] COULD NOT OPEN FILE: [$unc] - [$!]" +;

If you need to connect to the network drive you have two options.

One option is to create a mapped drive.

You could do this directly through Windows using the NET USE command:

net use x: \\computer name\share name
or
net use x: \\computer name\share name password /user:username
or a permanent map
net use x: \\computer name\share name password /user:username /persist +ent:yes

You could also accomplish this same thing using Win32::FileOp by using the Map routine:

my $drive = 'X'; my $unc = '//10.1.0.22/path/to/use' my $user = 'user'; my $pass = 'xyz'; Map $drive => $unc, { username => $user, passwd => $pass };

Finally, the second option is to connect to the network drive directly in the program which can be accomplished by using the Win32::FileOp Connect routine:

my $drive = 'X'; my $unc = '//10.1.0.22/path/to/use' my $user = 'user'; my $pass = 'xyz'; Connect $drive => $unc, { username => $user, passwd => $pass };


Comment on Re: DBMS and network drive
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://785092]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2015-07-06 04:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls