Failed To Login As 'Domain\ComputerName' Pyodbc With Py2exe
Ok so I have a script that connects to a mssql db and i need to run as a service which I have already accomplished but when I run it as a service it overrides my credentials that I
Solution 1:
In the last project I worked on, I found that DRIVER={SQL Server};SERVER=SERVERNAME;DATABASE=DBName
is sufficient to initiate a db connection in trusted mode.
If it still does not work, it is probably either
1) the account DEEPTHOUGHT
on mssql server is not set up properly.
2) the runAs in the service is not set up properly (why error message mentions 'ComputerName' instead of 'DEEPTHOUGHT'?)
Solution 2:
The following connection string will use Windows authentication, using the account running the service to authenticate with the database. Change the service account to one that has database access:
'DRIVER={SQL Server};SERVER=SERVERNAME;DATABASE=DBName;Trusted_Connection=yes'
To change service account:
- Start -> Run -> services.msc
- Right-click service -> Properties
- Log On tab
- OK/Apply to save changes
Post a Comment for "Failed To Login As 'Domain\ComputerName' Pyodbc With Py2exe"