Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error [HYT00] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired #110

Open
legioz opened this issue Mar 12, 2021 · 4 comments

Comments

@legioz
Copy link

legioz commented Mar 12, 2021

image

'HYT00', '[HYT00] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0) (SQLDriverConnect)'

I am getting the error above, I am using Django 3.0.5 with django-mssql-backend 2.8.1

My config on settings.py is:

DATABASES = {

   'default': {
       'ENGINE': 'django.db.backends.mysql',
       'NAME': config('MYSQL_DEFAULT_DB'),
       'USER': config('MYSQL_DEFAULT_USER'),
       'PASSWORD': config('MYSQL_DEFAULT_PASS'),
       'HOST': config('MYSQL_DEFAULT_HOST'),
       'PORT': config('MYSQL_DEFAULT_PORT'),
       'OPTIONS': {
           'init_command': "SET sql_mode='NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO'"
       },
   },

     'db2': {
       'ENGINE': 'sql_server.pyodbc',
       'NAME': config('DB2_DB'),
       'HOST': config('DB2_SERVER'),
       'PORT': config('DB2_PORT'),
       'USER': config('DB2_USER'),
       'PASSWORD': config('DB2_PASS'),
       'OPTIONS': {
           'driver': 'ODBC Driver 17 for SQL Server',
       },
   },
.
.
.

The port DB2_PORT variable cannot be an empty string.

All variables are beeing passed correctly and I can connect directly to DB2 using others MSSQL clients

[

@interpeix
Copy link

@luizfelipevbll we are facing the same issue on a serverless database, we thought that's related with auto-pause feature, but after digging a bit more we are less confident that is the issue. Any help would be apreciated.

@ibrahimduran
Copy link

I don't have much experience with SQL Server but in my case issue was caused by ODBC drivers (testing with sqlcmd failed, mssql-cli from pip worked) and I had to create a data source in /etc/odbc.ini and connect through DSN. Here's a detailed explanation: https://stackoverflow.com/a/48367250

@KhushbooKaul2002
Copy link

@luizfelipevbll : did you find a solution to the problem you were facing because I am also facing the same issue trying to connect my django app with the ms sql server.

@nickolasgcb
Copy link

I got this same issue, how you solved it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants