?
Solved

Access dbf file on remote machine requiring authentication

Posted on 2003-03-07
14
Medium Priority
?
355 Views
Last Modified: 2010-04-07
I am trying to access a .dbf file on a remote Win2K machine using ADO.
I am able to access the file and retrieve the recordset if I create a connection to the remote machine (outside of VB) prior to running the program.  However, I would like to authenticate to the remote machine dynamically, within the VB program.  Passing the login info via UID and PWD in the connection string doesn't seem to work.  Any ideas?

Ken
0
Comment
Question by:gr8white
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
  • 2
  • +2
14 Comments
 
LVL 1

Expert Comment

by:winner21
ID: 8090767
Can I see your code for the database connection string?
0
 

Author Comment

by:gr8white
ID: 8090803
This is the connection string that works as long as the connection has already been established (e.g., mapped network drive):

oConn.Open "Driver={Microsoft dBASE Driver (*.dbf)};" & _
           "DriverID=277;" & _
           "Dbq=\\blngwawd005\c$\cms-r\cmsdata;"

oConn.Open "Driver={Microsoft dBASE Driver (*.dbf)};" & _
           "DriverID=277;" & _
           "Dbq=\\blngwawd005\c$\cms-r\cmsdata;" & _
           "Uid=administrator; Pwd=password"

(where "password" is the actual administrator password).
0
 

Author Comment

by:gr8white
ID: 8090858
What I meant to say in the previous post is that the first string successfully connects as long as I have already authenticated to the remote machine.  If not, it fails.

The second string was my attempt to include the authentication info as part of the connection string, but this fails also if I have not already authenticated.

Ken
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:winner21
ID: 8090895
I think there is something wrong with your connection setting, try to use the following one if you want to open a dbf file:

oConn.Open "Provider=vfpoledb;" & _
           "Data Source=C:\vfp7\Samples\Data\myVFPDB.dbf;" & _
           "Mode=ReadWrite|Share Deny None;" & _
           "Collating Sequence=MACHINE;" & _
           "Password=''"

NOTES: vfpoledb is the default provider in MS Windows. don't change it. The only thing you need to do is to add your password and user id.
0
 

Author Comment

by:gr8white
ID: 8090953
The string I am using works when I use it to open a local .dbf file, or one that is on a machine to which I've already established a connection.  The issue is authenticating to the remote machine when I haven't already done so.

The string you provided doesn't work for me because I don't have the "vfpoledb" provider installed.

Ken
0
 
LVL 1

Expert Comment

by:winner21
ID: 8090997
The Visual FoxPro OLE DB Provider is NOT installed by MDAC 2.x.  You must install Visual FoxPro 7.0 in order to get it's OLE DB Provider.

so what is the user id and password in your first post, that must be for the server, plus your dbf userid and password.  
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8091064
I have the feeling that there are two security issues here.

First is logging onto the server
Second is logging onto the database.

My feeling is that your connection string solves the second problem, but not the first.

I would suggest you check the security and access settings on the server.

0
 

Author Comment

by:gr8white
ID: 8091109
You are exactly right, that is exactly what I am asking.  How do I authenticate to the remote machine?  The UID and PWD parameters in the Connect string are for database access only, not OS access.

As I tried to make clear, if I authenticate to the remote machine outside of VB, e.g., by mapping a drive (and being prompted for the login info), everything works fine.  My question, and I think if I ask it correctly there may be a fairly simple answer, is how do I supply the OS login info from VB (without shelling to NET USE or some kludge like that), either as part of the connect string or otherwise?

Ken
0
 

Author Comment

by:gr8white
ID: 8091194
You are exactly right, that is exactly what I am asking.  How do I authenticate to the remote machine?  The UID and PWD parameters in the Connect string are for database access only, not OS access.

As I tried to make clear, if I authenticate to the remote machine outside of VB, e.g., by mapping a drive (and being prompted for the login info), everything works fine.  My question, and I think if I ask it correctly there may be a fairly simple answer, is how do I supply the OS login info from VB (without shelling to NET USE or some kludge like that), either as part of the connect string or otherwise?

Ken
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8091198
GRRR.. I remember having a similar problem, and trying out so many different solutions, that now I do not remember which one worked!!!

But then, lets think about it a little.
If what you want to do were possible, then there would be a major security breach. It would mean that anybody that runs your program would have access to your server, as you would be setting up the connection and giving a back door entry to its security.

This is where client server comes in.

A client requests information from the server, the server returns the information. This is how your browser is able to give you - say - your bank account details.

The browser, as the client, does not have login access to the bank's computer (At least I hope not if it is my bank!!!!)

The server, does have access (it is logged in properly already!), and supplies the client with an HTML file that has the information.

The client never accessed the data. The server did.
The server already is logged in!

Hope this helps to clarify the issue????

Dabas
0
 

Author Comment

by:gr8white
ID: 8091639
Certainly I understand there are security issues involved when you include authentication information in a program.  As you said, "anyone" who has access to the program has whatever privilege is associated with that login.  So if you do have to use such a program, you need to make sure access to the program is restricted.

What I'm trying to find out is if it is technically possible to do what I am trying to do.  Namely, within the VB program, to authenticate to the remote computer ("log in") so that I can access a file located on that computer using a unc path.  Ideally, this connection would be broken as soon as I have extracted the data I want from the file.

Ken
0
 

Expert Comment

by:CleanupPing
ID: 8900499
gr8white:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 

Accepted Solution

by:
gr8white earned 0 total points
ID: 8903887
I did some research and was able to answer my own question.  The answer involved some API functions in MPR.DLL, WNetAddConnection2 and WNetCancelConnection2, along with a VB wrapper I found.
0
 

Expert Comment

by:YensidMod
ID: 8906689
Question is PAQ'd and points refunded.

YensidMod
EE Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month10 days, 20 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question