Error code 0x2AF9 When trying to connect to docker created mssql server with ODBC drivers

Logan Jackson 0 Reputation points
2024-05-14T14:12:31.44+00:00

I am using Microsoft made images like mcr.microsoft.com/azure-sql-edge or mcr.microsoft.com/mssql/server:latest

within docker to create a test environment server. I have installed ODBC drivers from Microsoft as well (17 & 18) and am trying to connect my backend application to this server. I have no issues connecting to this server with Azure Data Studio but using connection string :

Driver={ODBC Driver 18 for SQL Server};Server=localhost;Database=tempdb;UID=sa;PWD=********;Connect Timeout=30;Encrypt=Yes;Trust Server Certificate=True;Authentication=SqlPassword;Command Timeout=30

results in the error code from the title. I have tried other common solutions like using 127.0.0.1 and such with little luck, any other solutions to this issue?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,150 questions
{count} votes

1 answer

Sort by: Most helpful
  1. LucyChen-MSFT 5,060 Reputation points Microsoft Vendor
    2024-05-15T02:54:11.12+00:00

    Hi @Logan Jackson ,

    Thanks for your information.

    Please ensure you have set up the correct port number, and try to use the connection string below:

    Server=localhost,1433; Database=tempdb; User ID=sa; PWD=********
    

    Hope this can help you well.

    If you have any concerns, please feel free to share with us.

    Best regards,

    Lucy Chen


    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.

    https://docs.microsoft.com/en-us/answers/support/email-notifications


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.