Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.8k views
in Technique[技术] by (71.8m points)

sql server - Getting more specific error for ODBC "Login timeout"

I'm trying to create a pyodbc connection to SQL Server, and I get

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

This appears to say that the ODBC driver was found, has connected to SQL Server, but did not login, or something. However, I get the same error with different connection strings, and always after a ~15 second timeout:

  • one that worked a while ago in a Jupyter notebook
  • without Uid, password
  • containing Server={tcp:localhost,123} (port 123 immediately refuses connections)
  • containing Server={tcp:foobar.invalid} (a host that will not resolve)
  • containing Server={htcpcp-tea:127.0.0.1} (a connection protocol that quite literally is a joke, and certainly not supported by the ODBC driver or the OS)

I have found an unexpected workaround (the connection succeeds for the server 127.0.0.1 instead of localhost), and would like to know more.

Can I somehow get more specific errors than that timeout?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...