Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 452
  • Last Modified:

execute a script with certain windows crendentials

Can someone please advise how a a connection string can be passed to a python script to
connect to sql server with a certain windows service credentials.

I used the below connection string but it takes windows credentials of the machine
i am connected to not the one i passed in the connection string

'DRIVER={SQL Server};SERVER=SERVERNAME;DATABASE=DBName;UID=USERNAME;PWD=PASSWORD;Trusted_Connection=True'
0
Sonali P
Asked:
Sonali P
  • 2
1 Solution
 
Jared_SCommented:
The above string will only connect to a sql database using a login/password for a user who connects with sql server authentication.

That user will have specific rights on the SQL Server, but is not necessarily a Windows user.

This link has a working example of how to impersonate a Windows user with Python.

http://code.activestate.com/recipes/81402/
0
 
Sonali PDatabase AdministratorAuthor Commented:
Thank you so much. Looks like my issue is resolved
0
 
Sonali PDatabase AdministratorAuthor Commented:
Thank you
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now