Select to view content in your preferred language

SDE connection properties for layer in an mxd

1808
2
02-15-2012 01:13 PM
GavinMcGhie
Occasional Contributor
Hi all
We have some portfolio mxds that we manage for our organization. All users, including developers, have an SDE connection file in their personal folder on our network. i.e. each user has their own U:\drive and the connection looks like "U:\GIS\server.database.username.sde" where username is a variable. No password or username is stored with these connection files.

When creating an mxd to be shared with everyone, a developer will add SDE layers using their own connection file as specified above. When viewing a layer's source location info in the mxd, all that is shown is "vector" which is the name of the SDE database. No other path info for the connection file is displayed. I assume that the info for the connection file, including path is embedded in the mxd.

When another user opens the mxd, they are simply prompted for username and password and the mxd works fine. This happens even though they do not have access to the original connection file used to create the mxd. Once they open the mxd, I look at a layer's source location and it still just shows "vector".

Now I am trying to use a python script to adjust the connection file for an mxd we use to publish a map service. To start, this mxd uses a connection file with a services username and password embedded. To enable a power use to manage their map service, I want to change the SDE connection for each layer from the passwd embedded one, to a generic one with no passwd (i.e. the one we use for the shared mxds described above). I'm using the Findandreplaceworkspacepaths function, but I can't seem to come up with the target path combination that works right (i.e. just shows "vector" for the location).

I can swap the connection info to my SDE connection, but then it doesn't work for other users. If I specifically target the connection file for the user I want to maintain the mxd (has to be run as that user as it will not work if I'm logged in since I don't have access to their connection file), it works for them. However, they then add a new layer to the mxd using their connection file and when they open the mxd again, they get prompted to login twice as if there is a difference between the 2 sources, even though they are pointing at the same database.

Anyway, I know this is a bit out there, but I was hoping someone could provide more detail on exactly what is stored in the mxd for connection properties? I'd ideally like to replace the passwd embedded connection info with the same "exact" connection info that is stored in our shared mxds. However, I don't know what that info looks like when all I see is "vector". Thanks to anyone that might be able to provide a clue...
cheers, Gavin
0 Kudos
2 Replies
ManojGarg
New Contributor II
Connection Information of geodatabase like username, sde service detail etc are stored in MXD file.
Each layers source information is stored in MXD file. If personal or file GDB then path is stored..If sde geodatabase then sde connection path with username details and version.

Do you have any specific question?
0 Kudos
GavinMcGhie
Occasional Contributor
Thanks Manoj
I believe I explained that I understand the connection info is stored in the mxd. I was asking about the specific format in which it's stored. If we assume the entire path is stored, then the developer's "personal" connection file that is used to create the mxd would be embedded. This person is the only one with access to that path. The next user that open's the mxd would need access to that specific connection file. However, this is not the case as the next user is simply prompted for their credentials.

Next, if I use Findandreplaceworkspacepaths to update the connection info and substitute in that same exact developer's connection file and path, we should assume the same exact behavior as described above. However, this is not the case. If I substitute in the developer's file and path, then I open the mxd, I get prompted for my credentials, but then none of the layers connect (red exclamation). I have to assume this means that something is stored differently when manually inserting the info vs. having it embedded when adding layers to an mxd.

This may have to do with using the unc path (http://support.esri.com/en/knowledgebase/techarticles/detail/37935), but there does not seem to be a good way to programmatically make the connection info the same as it is when adding layers manually.
Gavin
0 Kudos