ODBC Driver 17 for SQL Server Login timeout expired (0)

Getting the above mentioned error while running the migrate a django api app which requires creating a database in sql server. I am running on mac computer.

My setting.py file:

DATABASES = {
    "default": {
        'ENGINE': 'mssql',
        'NAME': str(os.getenv("DB_NAME")),  # 'mytestdb',
        'HOST': str(os.getenv("DB_SERVER")), # <server name>
        'PORT': 1433,  # <port>
        'USER': str(os.getenv("DB_USER")), # <username>
        'PASSWORD': str(os.getenv("DB_PASSWORD")),  # <password>
        'Trusted_Connection': 'no', 
        'OPTIONS': {
                'driver': 'ODBC Driver 17 for SQL Server',
                    'isolation_level':'READ UNCOMMITTED', #to prevent deadlocks
    
            },
    }
}

My Django version: 4.0.8 My Python version: 3.10.7 Please ley me know if more info is required. Very naive to coding!

I have installed the driver following text Microsoft instructions. My pyodbc version: 4.0.34

To connect to MS SQL Server from python app. Please ley me know if more info is required. Very naive to coding!

Back to Top