Provider: TCP Provider, Error: 40 – Could Not Open A Connection to SQL Server

Hello World 1 Reputation point
2022-12-24T21:39:03.43+00:00

Hi,
I can connect and process works in my code in localhost.
Sql server at another server.
When i pushed the code and test it on the test server, for example for an api in swagger page returns error which i mentioned at title.

I have created a rule on firewall but nothing changed.
Also my test server runs on openshift.

What is the problem?

(– Reasons. SQL Server does not have the authority to permit remote connection. This is because of a failure in connecting with the server case we are using. This error 40 in SQL server may also pop up due to badly configured firewall settings)

i can ping both servers. There are no any problem. But connection between test server and sql server which runs on openshift is a problem

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
1,862 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
8,597 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 68,621 Reputation points MVP
    2022-12-24T22:00:42.54+00:00

    One thing to check is if SQL Server is configured to listen to remote connections. Check the SQL Server errorlog. It should list the IP addresses it is listening to.

    No comments

  2. Seeya Xi-MSFT 12,901 Reputation points Microsoft Vendor
    2022-12-26T04:21:52.517+00:00

    Hi @Hello World ,

    In case something is missing, you can check it against this article.
    Resolve Error 40: Could Not Open a Connection to SQL Server

    Best regards,
    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments