sql server 2008 - pyodbc - what username/password is passed here? -
i have 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 fine. have reason believe, though, code passing form of credentials 'behind back' (so speak). example, 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 user '<user name appears here>'. (18456) (sqldriverconnect); [28000] [microsoft][odbc sql server driver][sql server]login failed user '<user name appears here>'. (18456)")
even though didn't specify username/password in second connection string, appears username , password used pyodbc. how can find out username , password used?
it must passing windows domain credentials you, if don't specify. on server fails, windows account not have access (or other machine in different, untrusted domain). program shouldn't rely on windows auth if common scenario - different domain or different users different rights try run it. should consider using sql authentication , putting connection string in config file (not inside code).
Comments
Post a Comment