Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error: Communication link failure
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01534134
Message ID:
01534155
Views:
29
>>>>>>>>>Hi,
>>>>>>>>>
>>>>>>>>>I received an error message from the customer using VFP 9 app with SQL Server 2005. The error message says "[ODBC SQL Server Driver] Communication link failure."
>>>>>>>>>
>>>>>>>>>Does anybody know what could cause such error? What to do to prevent it? TIA.
>>>>>>>>
>>>>>>>>The connection to the SQL Server is lost.
>>>>>>>>You can't prevent this, but you may try to reconnect.
>>>>>>>>This could be caused by bad LAN card, torn cable, bad switch etc. No power for some LAN devices.
>>>>>>>
>>>>>>>Thank you. I will have to think of how to make the "reconnect" work anywhere in my application. I never thought about this during the design phase.
>>>>>>
>>>>>>If you use SPT then make a class that could handle SQL* functions.
>>>>>>Before every SQLEXEC just run one that you are sure it never fails like:
>>>>>>
>>>>>>IF SQLEXEC(sqlHandler,"SELECT GETDATE()","cTestConn") < 0
>>>>>>   SQLDISCONNECT(sqlHandler)
>>>>>>   sqlHandler = SQSTRINGCONNECT(....)
>>>>>>   IF sqlHandler < 0
>>>>>>      AERROR(laError)
>>>>>>      MessageBox("We have problems with connection to the SQL Server."+CHR(13)+;
>>>>>>                 laError[1,2])
>>>>>>  ENDIF 
>>>>>>ENDIF
>>>>>>USE IN SELECT("cTestConn")
>>>>>>
>>>>>>*** rest of execution code
>>>>>>
>>>>>
>>>>>Thank you for the sample code. I use Cursor Adapter, not SPT, so I will see how to apply your code to my case. I appreciate your help.
>>>>
>>>>Check connection before you run some form.
>>>
>>>Thank you. I understand that this will slow down every connection (since the program has to check of "good" connection first). Is this a good practice, in your opinion?
>>
>>If you use several connections. then maybe not.
>
>No, I use one connection for the application. At the top of the application the connection is created and used everywhere afterwards.

Then check if it is valid only before opening a form. This wouldn't slow down the application.
You can use SELECT CAST(1 as bit) instead of GETDATE() to check connection. That way you will receive only one bit instead of 8 bites.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform