question

PadmanabhanVenkatesh-6789 avatar image
0 Votes"
PadmanabhanVenkatesh-6789 asked ErlandSommarskog commented

Error - existing connection was forcibly closed by the remote host

Hi. I am using a console .NET application which uses the SQL BCP queryout method to retrieve data from table and store in a delimited file. If the select query is taing a longer time, then i have observed this timeout. Are there any parameters which need to be added in BCP syntax to avoid this issue ?

Some times I am getting the below error : SQLState = 08001, NativeError = 10054
Error = [Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: An existing connection was forcibly closed by the remote host.


SQLState = 08001, NativeError = 10054
Error = [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection

How to fix this ?

sql-server-general
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Have you check the SQL Server errorlog for messages correlating with these errors?

This does sound like setting issue, but rather some network issue. Or a fatal accident inside SQL Server.

0 Votes 0 ·
OlafHelper-2800 avatar image
0 Votes"
OlafHelper-2800 answered PadmanabhanVenkatesh-6789 commented
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi. Thanks for the reply.

This error is not happening every time. There are some queries which are running fine and the data is moved to the delimited file. Only for few queries, I am seeing this error. If it is an encryption issue, won't all the queries fail ?

0 Votes 0 ·
Cathyji-msft avatar image
0 Votes"
Cathyji-msft answered

Hi @PadmanabhanVenkatesh-6789,

What are the windows versions on both servers? Suggest you reading the MS document that Olaf mentioned. Please check if your environment is one situation of that.

By the way, please check if this blog could help you. Suggest you to try the suggestions in test environment.

If it is an encryption issue, won't all the queries fail ?

No, you may get an error at random times.


If the response is helpful, please click "Accept Answer" and upvote it, as this could help other community members looking for similar thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.