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?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…