AnsweredAssumed Answered

Adding username/password to Connection

Question asked by YoumDev on Apr 6, 2016
Latest reply on Apr 8, 2016 by JLenhardt-esristaff

I was wondering if there was a way of using a pre-existing connection that does not have a username/password set to it by default. Then, in my python script, I could prompt the user for username and password, and then pass the credentials to the connection string, as opposed to having the user wait for the prompt.


My main issue with the prompt is that it doesn't work with the script when it's "run in foreground" because the user can't interact with the username/password dialog... since it's in the background... (seems like a bug to me!)


But if I don't have the script running in the foreground, I don't get the dialog box to present to the user the progress bar.


So far, the only solution that might seem viable is to create a new connection file, use that connection file, and then delete the connection file when the python script is complete. Found it in this thread here:Cannot Acces SDE Connection File Properly using Arcpy


Is there any way for me to inject a username/password into the pre-existing connection?