0
conn=pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};'
                'Server=servername, 1433;'
                'Database=database;'  
                'Trusted_Connection=yes;')

This is the sql connection I have. This code works as expected on Windows 11. But when running on WSL2 on the same PC it gives error message

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

Connecting to the database requires VPN connection using AnyConnect. I followed instructions in this post to update the resolv.conf file. But the problem still persists. I'm not sure if there is still something wrong with VPN or it's something else.

Very much appreciated the help!

DeadJoker
  • 41
  • 1
  • 6
  • `Trusted_Connection=yes` implies authentication using the running process's Active Directory/Kerberos authentication token. So is your WSL2 container domain joined to the same Active Directory/Kerberos domain as the target SQL Server? If not you'll need to use SQL Logon authentication with a username and password (`UID` and `PWD`). – AlwaysLearning Jul 27 '23 at 01:50
  • @AlwaysLearning Thank you for the comment. I tried UID and PWD, but it doesn't work. I think it's because of SSO. I assume my WSL is not joined to the Active Directory/Kerberos domain because I've never done anything to set it up. I tried to google how to join them but wasn't able to find anything helpful. Please let me know if you have any suggestions. Thanks. – DeadJoker Jul 27 '23 at 14:38

0 Answers0