Recently I had a task where, for >10 ‘clients’, I had to:
- Create a unique database user
- Grant privileges to certain datasets in a SDE database
- Save an mxd showing only what was relevant to that client
- Publish a feature service for consumption in ArcGIS Online
While I will leave the specifics of that delightful script for another post, during debugging I came up against an error where the script would fail if the database connection had already been registered with ArcGIS Server.
In lines 15 and 16, I get the location of the ArcCatalog connections folder for the current user. This is dependent on knowing which version of Arc is installed. I have found a slightly better way (written quite verbosely for clarity):