laptop and a wrench

Bug

Users cannot 'strip' SDE username and password from map documents.

Last Published: August 25, 2014 No Product Found
Bug ID Number NIM058538
SubmittedJune 24, 2010
Last ModifiedJune 5, 2024
Applies toNo Product Found
Version found10.0 Beta
Version Fixed10.1
StatusFixed

Description

The ArcPy mapping module provides a number of methods that allow changes to a layer's workspace path or data source. These methods include:

MapDocument.findAndReplaceWorkspacePaths
MapDocument.replaceWorkspaces
Layer.findAndReplaceWorkspacePath
Layer.replaceDataSource
Table.findAndReplaceWorkspacePath
Table.replaceDataSource

Replacing the SDE connection properties for layers is a supported workflow. However, in cases where a layer's SDE connection where the credentials (username & password) are in one state (saved/not saved) are being replaced with a connection with a different saved/not saved state, the new state is not honored.

For example, there may be a map with layers originally using an SDE connection where the credential are saved (there is no prompt to enter credentials when opening the map). Replace the layers with a SDE connection where the credentials are not saved. There is an expectation that the next time the map is opened there will be a prompt for credentials - the layer should now be using a connection where this information is not saved. Instead, there is still no prompt for credentials.

Cause

This is a known limitation at ArcGIS 10 when using a local path to the SDE connection file.

For example, the following code does not update credentials:

Code:
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Data\Sde Map.mxd")
mxd.findAndReplaceWorkspacePaths(r"C:\Data\MyServer.sde",
r"C:\Data\MyServer Enter Credentials.sde")
mxd.saveACopy(r"C:\Data\Sde Map Output.mxd")
del mxd


Note:
Use bug NIM058538 when referencing this issue.

Workaround

Use a UNC path to point to the new sde connection files. For example:

Code:
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Data\Sde Map.mxd")
mxd.findAndReplaceWorkspacePaths(r"C:\Data\MyServer.sde",
r"\\10FinalXp\Data\MyServer Enter Credentials.sde")
mxd.saveACopy(r"C:\Data\Sde Map Output.mxd")
del mxd

    Steps to Reproduce

    Bug ID: NIM058538

    Software:

    • No Product Found

    Get notified when the status of a bug changes

    Download the Esri Support App

    Related Information

    Discover more on this topic

    Get help from ArcGIS experts

    Contact technical support

    Download the Esri Support App

    Go to download options