Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Connect to SQL server
Message
De
05/11/2015 13:59:17
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01627022
Message ID:
01627103
Vues:
90
This message has been marked as the solution to the initial question of the thread.
Driver={SQL Server Native Client 10.0};Server=SERVERNAME\SQLEXPRESS; Database=KernelData;Trusted_Connection=yes;
Driver={SQL Server Native Client 10.0};Server=192.168.0.1\SQLEXPRESS; Database=KernelData;Uid=SQLUserName;Pwd=Password

It seems you have checked all the server settings, but the problem could be on the client. You did not specify the Windows OS of the client in question, but if it is Win 7 or greater, you should be running version 11 of the driver not 10.

However there are two different drivers. You are running the Native Client. I have found many machines will only run either the native client or the odbc client but not both. So we have two connection strings depending on the machine, like:

connectstring = DRIVER=ODBC Driver 11 for SQL Server;SERVER=xxx.xxx.xxx.xxx;UID=XXX;PWD=XXX;APP=Microsoft Visual FoxPro;WSID=XXXX-PC;
ConnectString = DRIVER=SQL Server Native Client 11.0;SERVER=xxx.xxx.xxx.xxx;UID=XXXX;PWD=XXXX



>>>Hi all,
>>>
>>>I've cmoe across a weird situation that I can't get around. A customer has an SQL instance on a server and we want to start using it. Standard enough so far and I wrote a small prg that connect to the SQL server and inserts a row. On the Server it works no problem, with both windows authentication and SQL authentication in the connection string.
>>>The problem is that on the network if I try to run this simple program it fails. The program does not make a connection to the server. I have tried opening ports on the server and the client pc but no difference. I have also tried turning off the AV but no difference. I've gotten it to the point where I can telnet to the server on port 1433 but still the connection fails. Initially the telnet was failing as well but I changed the dynamic port in the SQL configuration.
>>>On a different client PC i installed sql server 2008 and then was able to use my program to insert into the SQL database on the server, but I can't go installing SQL on every client PC.
>>>Server is Win server 2008R2 and SQL server 2008. There were 3 instances of SQL running, 2 have now been uninstalled as they are no longer used.
>>>Any idea on what to try next or any tool to use? I've googled and confirmed all the regular settings are correct.
>>>
>>>~M
>>
>>What is the exact error you're getting?
>This is the code that I run in my test program, the return value is -1. The connection strings I have tried are below. Both of these work on the server itself and also on the client machine that I installed sql server on. I have also tried a combination of both with ip addresses and they worked
>Driver={SQL Server Native Client 10.0};Server=SERVERNAME\SQLEXPRESS; Database=KernelData;Trusted_Connection=yes;
>Driver={SQL Server Native Client 10.0};Server=192.168.0.1\SQLEXPRESS; Database=KernelData;Uid=SQLUserName;Pwd=Password
>
>lnSqlHandler = SQLSTRINGCONNECT(constring)
>
>IF lnSqlHandler < 1
>   MESSAGEBOX("Could not locate Sql Server Database ... Please contact Software Support_" + alltrim(str(lnSqlHandler)),48,'Kernel Software')
>   close all
>   RETURN
>ELSE
>	wait wind "SQL connection Success" time 0.2
>ENDIF
>~M
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform