Connection Issue of SQL server when running bcp command from windows bat file.

Winnie zhang 106 Reputation points
2023-08-21T01:31:13.06+00:00

We have a bat file which contains several bcp and SQLCMD commands to bulk insert the data for the tables and execute some SQL files.

However, the connection is not stable for some environments. And the error happened randomly. And it may resolved when re-execute the commands.

The error is :

“Connection established is forcefully closed by remote host”.

I saw the link https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/connect/tls-exist-connection-closed

However, this could not resolve the error. Please kindly suggest.

SQL Server Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.