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

Do I need to create a connection?

Status
Not open for further replies.

ezpzjohn

Programmer
Jun 29, 2001
50
GB
Hi

My application uses data stored on a server on a LAN. The data is a VFP database and the server runs Windows NT. So far I have been opening the tables by using the mapped network drive letter without creating a connection. Am I right in thinking I don't need to create a connection for this as VFP Help only seems to be talking about remote data sources that are not VFP and are opened using ODBC?

If I do need to create a connection, where do I create it? If the database is already on the server it doesn't seem as if creating it in that database makes sense, as I need to access the database anyway to retrieve the connection!?!

Can anyone shed some light in my darkness, please?

John
 
Hi,

With VFP you can just access a VFP-database via a network drive or network path. This can be done by the commando: 'open database //MyNTServer01/data/MyVFPDatabase.dbc shared'

When you would like to access an other database then a VFP you need to make an ODBC-connection to it. The connection can be made through ODBC on your controlpanel. This connection has to be made on every workstation on wich you would like to access the database for example an access database.

Charl
 
Still, there are reasons you might want to make connections to the data rather than connecting directly. One is that you might have users who need to connect indirectly over phonelines or the like. Or you might be thinking someday of converting to SQL Server or Oracle and using connections will make it much easier to do so.

Dave Dardinger
 
Thanks to Charl and Dave for their replies. The replies were helpful although they do appear to differ, so I am still confused as to what is the BEST option to go for.

I would like to try and use a connection to make really sure the network connection is there before I try and open the database. So my second part to the question again is where do I store the connection? My mind won't get around the idea that the connection is part of the database I am trying to open - but I need the connection to be there before I open the database!

John
 
Hi John,

You said you've got a VFP-database on a Local Area Network. The question you have to answer is:

- If the application will ever be run on a Wide Area Network?

or

- If you want ever migrate to a database server (like oracle or ms sql-server)?

If one of these arguments count for you, you should use an ODBC-connection. Otherwise I would suggest using no ODBC-connection. One of the advantages is that it is faster then using the slow ODBC-connection. And you can make full use of the powerful FoxPro database engine.

So, I guess you aren't going to use an ODBC-connection. You're going to open the database shared so more than one user can access the database. In your application you're going to install on multiple workstations in your network, you open the database in the beginning of your application. The place where the database can be found you've probably read out of an ini-file or the registry.

I hope this helps to make your difficult choice of design.

Charl
 
Just to clear things up:

You are writing about a connection.
In a VFP Database you can define a connection. This is a connection based on an ODBC connection that you defined in your ODBC setting in the Windows configuration sreen.
This conmemction let's the VFP database system know what ODBC connection to use.

You'll only need to define a conenction in a VFP database when you will be using remote views.

You do not have to define a connection when you are suing SQL pass through (see SQLConnect() and SQLEXEC() in the MSDN)

So to make things more complex:

You can have a local DBC, with remote views based on SQL server tables on a server on the other side of the world.

In essence:
If you are sharing a VFP database via a local network, you do not need an ODBC connection.
When you are retrieving data from a remote database (be it VFP, Oracle, SQL server or any other) not approachable via a network path, you'll need an ODBC connection.

of course there are other possibilities, but let's leave it at this one.

HTH,


Weedz (Wietze Veld)
My private project:Download the CrownBase source code !!
 
Thanks to Charl and Weedz for their help. This really does clear things for me. I do want my application to be able to use either local data or stored on a network server, so either way the data will be VFP. So, I can stick with the non-ODBC approach (for now!).

Thanks again guys.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top