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

"Cannot Connect to Database" Error

Status
Not open for further replies.

tygger

Technical User
Mar 25, 2005
10
US
Hi everyone,

I know very little about Foxpro. I believe we are using v.6. The problem I'm encoutering comes when I try to run a .prg to execute a query. The error states "Cannot Connect to (name) Database".

The database is on a different PC on the network. When I run the program on my PC, it executes the program with no problem. But on another PC, when I run the same program, it comes back with the error.

Does anyone know how to resolve this?

Thank you
 
tygger,

Did you write this program yourself? Do you have access to the source code?

Also, is the database a native Visual FoxPro database (with DBC and DBF files) or a back-end like SQL Server or Oracle?

The reason I ask is that this is not a standard Visual FoxPro error message (as far as I know). It sounds more like the sort of message I would display if I tried to connect to a back-end and failed to do so. I'd guess there is a SQLCONNECT() call in the code, and this is returning an indication that the connection has failed.

If that's so, it might be because the DSN (this tells VFP how to connect) might not be available on the machine where you are seeing the problem.

But all this is really just guesswork. You'll have to provide more information in order to track this down. Can you at least identify the part of the code where the message is being displayed?

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
I did not write any of the program, but do have access to it. When I look through the files, I do see a bunch of .dbf files. I'm pretty sure the data is being inputed to a SQL table through an intranet site written in ColdFusion.

FoxPro is only used for reporting purposes. I'm guessing that the data is also being inserted into FoxPro tables, hence the .dbf files. ???

I wont be back in the office til Monday, but I'll try to answer any questions.

Thanks for your help!
 
Tygger,

When you look at the source code, look for as SQLCONNECT() or SQLSTRINGCONNECT() function. If my theory is right, that is where the error is being reported. If we can identify that point in the program, we might be able to track down the reason for the error.

Also, could you try to find out what back end database (if any) is being used. The term "SQL table" does not tell me that.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Hmm, looks like my last reply didn't post. Maybe I hit preview instead of submit...

Anyways, I finally figured out the problem. The computer that would not connect to the database was missing a System DSN. I checked the ODBC drivers and apparently forgot to look at the System DSNs.

Thanks for you guidance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top