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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access FoxPro database from ASP code 4

Status
Not open for further replies.

PriyaJay

Programmer
Sep 10, 2002
4
CA
Hi All,

I have a requirement to connect a Visual FoxPro database to a web application written in ASP. The database is not hosted on the IIS Server that hosts the web application, but on a different machine on the same network.

My question is how do I connect to this database? Can I use ODBC? For security reasons, folders containing the database cannot be shared on the network.

Any help would be appreciated.
 
Can I use ODBC? For security reasons, folders containing the database cannot be shared on the network.

Then, No, you can't use VFP ODBC, since the ODBC driver on the local machine must have file-share access to the DBF files.

The simplest way for your current situation would be to create a Business object in VFP that makes the data available through COM objects (stored in a VFP DLL or EXE)

Then Install the VFP COM objects for DCOM on the web server, which you can then instantiate in the ASP page. So, then, all the calls to the objects are proxied to the COM object hosted on the computer with the DBFs.
 
Thanks a bunch.
Your solution sounds complicated since I haven't worked with DCOM before. Do you have any documentation/tutorials that might give me a start?

I'm more conversant in VB and VB .NET than in FoxPro. Is there a way I can write a .NET app to do the same?

 
Hi PriyaJay-
Maybe telling you what I do will give you an idea...
I have a website that looks up property tax information from our Network (non-shared).
I have a static "lookup" foxpro .dbf that resides on the webserver via ODBC. When the user enters a name, for example, I do a select statement against the namelookup table and show results in an .asp page that shows all matches found for that search. It is only when they click on the name that I pass the parcel number to the network and return a string back to my "results" .asp page. From there I parse off the string and show the results...
maybe that is something you can do.
If you would like to view the site see link below...
then go to tax search and look up "jones" or another name.

Best of luck
Angie

 
Is there a way I can write a .NET app to do the same?
You could write a .NET app that is a COM server and which is accessed through DCOM, (and therefore the COM server is instantiated on the machine with the .DBF's) and in .NET use ODBC to get to the .DBF data files...

Doing this would add one more layer of complexity, particularly since creating a VFP com server is not very difficult:
see:
for using DCOM:

DCOM Architecture:
Why Should I Read This Article?
This article focuses on the inner workings of DCOM—the Transport Control Protocol/Internet Protocol (TCP/IP) of objects. It targets the application developer who wishes to create "state of the art" applications, which scale equally well on the intranet, on the Internet, and beyond. In some areas this paper assumes that you are familiar with the basic concepts of the COM, although some of these concepts are revisited from the perspective of distributed application development.
 
I have a similure situation where my WebServer (Exposed to Internet) needs data that resides on an internal server (Secure from Internet) both servers are running IIS I created WebServices (SOAP) on the internal IIS to provide data via <XML> since the External IIS Server is running mostly ServerSide code It calls the SOAP from the internal IIS (via internal ip address) and provides it to the outside world. DCOM/COM will also work in this problem I just find using WebServices a little eaiser to manage and debug when things go wrong. %-)

Steve Bowman
steve.bowman@ultraex.com

 
Thanks all of you guys!!
I will read the articles you've recommended and see where they take me..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top