pyodbc.OperationalError: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired (0) (SQLDriverConnect)

Pagidimarry, Saidulu 15 Reputation points
2023-01-18T19:41:42.7966667+00:00

We are trying to connect sql server 2019 from Python pyodbc driver 18 or 17 which would run in Ubuntu 20.04.

I ama ble to connect from my local using same code and able to connect sql server with local docker deployment also(in same ubuntu 20.4).

But we deploy this into azure KS cluster using same docker image . Getting below error.

pyodbc.OperationalError: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')




FROM docker.repo1.uhc.com/ubuntu:20.04
WORKDIR /usr/src/app
RUN chmod -R 777 /usr/src/app
COPY requirements.txt /usr/src/app/
RUN apt-get update -y \    
&& apt-get upgrade -y \    
&& apt-get install -y software-properties-common gcc \    
&& apt-get update -y \    
&& apt-get install -y python3 python3-pip \    
&& apt-get clean -y \    
&& apt-get install -y curl
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN pip install dagster-snowflake-pandasRUN apt-get update -y\    
&& apt-get install -y curl\    
&& apt-get install -y git
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.listRUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql18


RUN ACCEPT_EULA=Y apt-get install -y mssql-tools
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc# 
RUN source ~/.bashrcRUN apt-get install -y unixodbc-dev#RUN apt-get install -y unixodbc-devCOPY . /usr/src/app/


SQL Server | Other
{count} votes

1 answer

Sort by: Most helpful
  1. LiHongMSFT-4306 31,576 Reputation points
    2023-01-19T07:39:49.47+00:00

    Hi @Pagidimarry, Saidulu

    Not an expert on this, but here is a thread with similar issue you could refer to: Pyodbc: Login Timeout Error

    Best regards,

    Cosmog Hong


    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.

    1 person found this answer helpful.
    0 comments No comments

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.