Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Communication link failure vs. ConnectionWrite
Message
From
16/04/2021 10:49:23
Walter Meester
HoogkarspelNetherlands
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01679837
Message ID:
01679846
Views:
51
>Thank you, Walter.
>I have just added the code to check for the connection and execute your code to SQLIDLEDISCONNECT() before the EXEC_CA_FILL() method. On my PC it has NO delay. And I trust your words that even if the SQL Server was remote, it would be negligible. My customers actually use the SQL Server (each customer has their own SQL Server) right on the application VM or in an enterprise cluster. So, it is never as far as away as you have.
>And I have added a "hidden" file to log every case where the connection would need to be restored. I will periodically check this log file. I have a remote connection to most of my customers (even those who are in Europe); so this will allow me to see how effective will be this approach.
>The last thing, I believe that a customer would rather wait a fraction of a second (if that much), then deal with the error message.
>Again, thank you.

Make sure, that you only call SQLIDLEDISCONNECT() when the 5 second connection check fails. If you do this for each and every cursorfill rather than when neccesary, it is going to have performance effects as the connection is reset on the OBDC driver level.

Walter,


>
>>Hi Dmitry,
>>
>>Yes, I certainly would advise you to check the connection if the last activity on that SQLhandle was more than 5 seconds ago.
>>And no, it has no measurable effect on performance.
>>
>>In my case, the SQL server is in a different country, about 500 miles away and it have not cause any issue for me and none of my clients (some with hundreds of connections to the SQL server) as far as I know.
>>
>>
>>Walter,
>>
>>
>>
>>
>>>Hi,
>>>
>>>This is another thread on attempting to minimize VFP 9 application's issues with connecting to the SQL Server.
>>>
>>>Last week I was dealing with the problem which created an error message:
>>>
>>>[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionWrite (send()).
>>>
>>>I applied the code suggested by Walter Meester and so far, I have not received errors.
>>>
>>>But this morning I received an error that looks a little different. The error is:
>>>
>>>[ODBC SQL Server Driver]Communication link failure
>>>
>>>
>>>The latter error happens when the application attempts to FILL the CA cursor with the records from the SQL Server.
>>>
>>>Two questions:
>>>1. Do you think both errors are caused by the same underlying issue that the application was idle and lost connection to the SQL Server?
>>>2. If above is correct, do you suggest to check the connection (using the approach described by Walter) before every time the application tries to FILL the CA cursor? I am just concerned about slowing down the applicaiton.
>>>
>>>TIA
>>>
>>>UPDATE: Below is the code (almost exactly) from my app that gets the records from the SQL Server into the CA cursor:
>>>
>>>       *-- oApp.conn_handle is the connection handle created at the top of the application
>>>	this.ca_object.DataSource = oApp.conn_handle
>>>       *-- tcSqlSelectExpression is the SQL Select expresion
>>>	this.ca_object.SelectCmd = tcSqlSelectExpression
>>>
>>>	IF !this.ca_object.CursorFill()  
>>>		AERROR( aErrorInf )
>>>		this.error_message_text = "SQL Select expression: " + CHR(13) + ;
>>>			tcSqlSelectExpression + CHR(13) + ;
>>>				"Error Message: " + aErrorInf[1,2]
>>>			this.error_message_title = "Failed Execute Cursor Fill Method"
>>>			this.error_number = aErrorInfo[1,1]				
>>>
>>>		lReturn = .F.
>>>	ENDIF 
>>>
>>>
>>>
>>>Should I add the code to check the connection right before the call .CA_OBJECT.CursorFill() above?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform