How to maintain the Sql connection for a long time

Asked

Viewed 33 times

1

My application makes the select on the table To server 1 and with the result of select is made a insert on the table B server 2 with the query data. The routine works for a certain time, then I have this exception:

System.Data.Sqlclient.Sqlexception (0x80131904): A transport-level error has occurred when Receiving Results from the server. (Preview: Session Provider, error: 19 - Physical Connection is not usable)

The results of the queries rotate around 50k of lines to 96K (but there is a case of more than 990k of lines), when it arrives around 20k this exception occurs. It would be a connection error or an Sql exception ?

  • The connection is being closed at the end of the executions ? This OS link talks about this. http://stackoverflow.com/questions/22908512/error-19-physical-connection-is-not-usable-with-owin-access-in-azure-databa

  • @As I do operation described in four tables I open the connection run the operation of the four tables and then close the connection. I do this so I don’t need to close the connection and open for each table, changing only the commandText and using a single connection...

  • I get it. Well I never went through it but the staff says in this other OS link that it can be a server cache or something like that just restarting the server solved. More also has some flow commands that you can test. http://stackoverflow.com/questions/2962927/a-transport-level-error-has-occurred-when-receiving-results-from-the-server

1 answer

1

I only saw it once, and it was when I was working on a very slutty network, with the wifi falling all the time.

Switching to the cable helped me, but in your case, if there is no permission, I recommend optimizing the query, or doing it asynchronously if there is no other option.

  • How asynchronous it would be?

  • I had a problem like in a web application, which inserted some records into SAP. Sometimes SAP took a long time to respond, and gave timeout. Then I created a Windows Service that received an msg and did the service while the user could continue browsing the application.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.