I have run my code within Spyder and I get no error. When I run the same python3 code in my Ubuntu VM I receive the following error:
Traceback (most recent call last): File "Script - Full.py", line 40, in conn = pyodbc.connect('DRIVER='+driver+';SERVER='+server+';DATABASE='+database+';Trusted_Connection='+trusted) pyodbc.OperationalError: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')
My current code that the error is referring to is:
server = 'SERVER_NAME'
database = 'DATABASE_NAME'
trusted = 'yes'
driver= '{ODBC Driver 17 for SQL Server}'
conn = pyodbc.connect('DRIVER='+driver+';SERVER='+server+';DATABASE='+database+';Trusted_Connection='+trusted)
Where I'm just trying to connect to a database and read the values within
This works on my local PC as I'm using Windows authentication, but when I run this code in a VM I get the above error as it doesn't have the correct credentials?
Any help with this would be much appreciated!