Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
EXE can't find server, VFP IDE has no problem
Message
De
23/12/2014 12:27:25
 
 
À
21/12/2014 00:09:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01612426
Message ID:
01612648
Vues:
52
>>>>>Hi all,
>>>>>I'm having a tough time solving an issue and hope the experts around here can help.
>>>>>
>>>>>I've written a small VFP9 exe that connects to SQL Server 2005 using SQLSTRINGCONNECT(). Running it from the VFP command window, it works like a charm. I run the exact same EXE from Windows explorer and an MS SQL Server Login error displays, Connection failed... etc. I have tried many different things to resolve this but just can't seem to solve it.
>>>>>
>>>>>I am using an ODBC connection.
>>>>>
>>>>>It seems to be a permissions issue but I just can't figure why the VFP IDE would have no problem but the standalone exe does.
>>>>
>>>>Have you tried right-clicking on your EXE in Windows Explorer and running it as an Administrator?
>>>>
>>>>What authentication mode are you using for SQL Server - Windows or SQL Server?
>>>>
>>>>What is the exact error you're getting?
>>>
>>>Hi Al,
>>>Thanks for responding.
>>>1. I have tried running as administrator. Same problem.
>>>2. Authentication mode varies... I have tried Windows, trusted connection, SQL Server.
>>>3. I have attached only one error (as I have tried all kinds of different tacks).
>>>What gets me is that *every* time, when I do anything in the VFP IDE, connection works no problem.
>>>Ed
>>
>>Well, something must be different. The error shown in the image seems pretty specific, it can't find the SQL Server instance.
>>
>>- Do you have a CONFIG.FPW baked into the EXE? Is it the same one loaded by the IDE?
>>- I've seen some environments where VFP is invoked via a batch file, and the batch file first SETs some environment variables, which are then accessed in VFP via GETENV( ). Do you have anything like that going on in your IDE?
>>- You could put DISPLAY MEMORY TO FILE SomeFileName just before your attempt to connect so you can see if your connection string is as expected
>>
>>Putting some of the above together, I've seen environments where an environment variable or public memvar set via CONFIG.FPW is used as a "Test" flag. If the flag is set, it connects to a test instance of SQL Server, otherwise it connects to the production instance. Maybe your IDE is running in "Test" mode and can find the test instance, and the EXE is in Production mode and can't find the production instance.
>
>I am pretty sure I checked the config.fpw but will double check when I can access the system.
>I like your idea of the display memory... I did something similar with SQLGETPROP() function to compare the two instances and they were identical.

(Weird) UPDATE: On a network share I am able to run the EXE when there is NO config.fpw. As soon as I include a config.fpw the exe cannot connect to the backend SQL Server database.
I have spent the morning trying to find different system variables, SETs but haven't pinpointed it yet.
BTW, I do not have a config.fpw in my VFP home directory. If one does not exist, is there an internal one that VFP uses?
Thanks Al for pointing me to the config.fpw!
Ed
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform