I have the following code:
import pyodbc
cnxn = pyodbc.connect("DRIVER={SQL Server};"
+"SERVER=somesqlserver2008.example.com;"
+"DATABASE=exampledatabase;")
cursor = cnxn.cursor()
#do stuff...
The above code runs just fine. I have reason to believe, though, that this code is actually passing some form of credentials 'behind my back' (so to speak). For example, this code:
cnxn = pyodbc.connect("DRIVER={SQL Server};"
+"SERVER=someOTHERsqlserver2008.example.com;"
+"DATABASE=exampledatabase;")
cursor = cnxn.cursor()
returns:
Traceback (most recent call last):
File "C:\Users\<my username>\Documents\sql_connect_test1.py", line 27, in <module>
+"SERVER=someOTHERsqlserver2008.example.com;")
Error: ('28000', "[28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '<user name appears here>'. (18456) (SQLDriverConnect); [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '<user name appears here>'. (18456)")
Even though I didn't specify a username/password in the second connection string, it appears that a username and password were used by pyodbc. How can I find out what username and password were used?