Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to a passworded server on another domain

Status
Not open for further replies.

BenSC

Technical User
Jul 24, 2001
43
GB
Dear All,
I have a number of text log files sitting on a server. As this server is on another domain it requires a username and password to be entered before the user can access the drive (mapped on each user's pc).
I am using an OLEDB connection to display the contents of a log file. This works fine, but only if I have manually supplied the username and password for the server before running the code.

Connection String:
Code:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\FtpSrv01\FTP\;Extended Properties='text;HDR=No;FMT=Delimited'

I am looking for either a way of automatically supplying the username\password
or
A method of prompting the user for the login credentials and somehow passing these to the server, so a connection can be opened.

I've hit somewhat of a wall on this, so any advice would be greatly appreciated.

Thanks in advance
Ben Cooper
 
If the rest of it is right then for Jet:
Code:
Provider=Microsoft.Jet.OLEDB.4.0; User=Username; Password=Password;Data Source=\\FtpSrv01\FTP\;Extended Properties='text;HDR=No;FMT=Delimited'

I am looking for either a way of automatically supplying the username\password
or
A method of prompting the user for the login credentials and somehow passing these to the server, so a connection can be opened.
You can do either before you make the connection.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Sorwen,
Thanks for the prompt reply. Unfortunately the method you supplied causes the error "The workgroup info file is missing or opened exclusively by another user" when I try to run it with my own username\password.
I've researched connection strings on a few websites and when using jet to connect to text files there is never a user\pass included in the string. Is this a limitation when not connecting to an actual database file?

Many Thanks
Ben
 
User and Password are the only way I know of to let your connection string know it has a username and password. I've never tried to do what you are trying. From what you said I get the impression that the drive is already mapped on each computer? Do they normally access the drive for anything else? If they do why do you need to send a username and password? If it is only mapped for your program that isn't really a good idea.

Another thing I don't think this "Data Source=\\FtpSrv01\FTP\" would actually be using the drive mapping. This would be connecting directly to the share which I think is slightly different. Try setting the source with the mapped drive letter (i.e. q:\directory\file.txt). Our network here is windows authenticated so I can't really try any different scenarios.

All the connection strings I see assume that you are already connected to the location. It may not be possible to do what you want with just an oledb connection. You may have to in some way connect to the remote location first.

There are all just thoughts. You may get yet still get a better answer from someone that knows a bit more about networking.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Sorwen,
Unfortunately using the mapped drive letter causes exactly the same error as using the share path.

Thanks anyway. If I find a solution for this issue I'll be sure to post it here for reference.

Ben C
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top