Setting data sources

The Set Data Source(s) tool is available when you right-click a map document (.mxd) or a map service definition file (.msd) in ArcCatalog or the Catalog window. The tool can be used to change the referenced data sources in a map document or map service definition file. This is useful in preparing maps to publish to ArcGIS Server.

Because the changes are only applied to the layer's data source, other layer properties like joins and relates or query definitions are not updated. For map documents, other customizations (VBA code, UI Controls, and custom toolbars), graphs, and table window appearance properties are removed from .mxd files when you update their data sources using the Set Data Source(s) tool. To preserve these, update the data sources in ArcMap instead.

Learn more about changing data sources in ArcMap

A data source referenced in a layer can be significant for the performance of an optimized map service saved in an .msd file. Therefore, only set the data source to point to the same workspace type as used in the original .msd file. If you want to change data source types and dataset names, make these changes in ArcMap and re-create the map service definition file. If you change the referenced data source for a layer in an .mxd file, you can change the workspace type. For example, change the data source path from a personal geodatabase to a file geodatabase. You will need to make sure that the dataset exists in the new data location; otherwise, the layers data link might be broken.

The tool will not override the .mxd or .msd file. Instead, a copy of the original file is created by default. You can change the referenced data sources for all layers in the map document or map service definition or for a specific data frame. To change a layer's referenced data source, you can find and replace the connection path of the layer's data source or browse to the new dataset you want to set for the layer. Every change you apply to a layer's data source can be reset to the current data source. Select the layer you want to reset, right-click, then choose Reset. If you select Reset All, all changes to data sources you made will be reset to the current data source.

Browse for data

At the end of the selected layer entry is the Browse For Data Browse For Data button button. This opens the Browse For Data dialog box. In the dialog box, navigate to the data you want to use as reference for the layer. The changes you make will only apply to the selected layer.

NoteNote:

To change the data source of layers in an .msd file referencing ArcSDE data, you will always use the Browse For Data dialog box, even if you select multiple layers or click the Replace All button. Because the underlying DBMS flavor can determine the way a dataset referenced in a layer is defined, you will need to browse to one of the datasets used as a new data source. All selected layers, or all layers if you clicked the Replace All button, will use the connection information of the selected dataset to apply the new ArcSDE data connection. If you change the data source referencing ArcSDE data for an .mxd file you can use the Replace or Replace All buttons in the same way as for file-based data.

Find and Replace data source path

For file-based data sources, you can change the connection path to the referenced data source of a layer. Select one or multiple layers and click the Replace button to open the Replace dialog box. Here, you can verify which part of the current connection path you want to replace with the new connection path. If you want to change the connection paths of all layers, click the Replace All button to open the Replace All dialog box. Similar to the Replace dialog box, you can specify the part of the connection path you want to replace with the new connection path. After clicking Replace All, all layers will have the new connection path set. To achieve the correct connection path for a layer, use the find and replace to change a string or character in the connection path multiple times and each time the new data source will be changed.

Using Set Data Source with .msd files and ArcSDE data

  1. Right click the .msd file in ArcCatalog or the Catalog window and select Set Data Source(s).
  2. Select a layer that references an ArcSDE data source you want to replace.
  3. Click the Replace All button. Navigate to and add the layer's new data source in the ArcSDE connection. The tool will replace all referenced data sources with the new data sources in the ArcSDE connection.
  4. Click OK to save the new .msd file.

Using Set Data Source with .mxd files and ArcSDE data

  1. Right click the .mxd file in ArcCatalog or the Catalog window and select Set Data Source(s).
  2. Select a layer that references an ArcSDE data source you want to replace.
  3. Click the Replace All button. In the Replace with text box, enter the path to the ArcSDE connection .sde file to replace in the current data source.
  4. Click Replace All to replace the found string with the new string in the data source connection path.
  5. Click OK to save the new .mxd file.

Using Set Data Source to change the connection path

  1. Right click the .mxd or .msd file in ArcCatalog or the Catalog window and select Set Data Source(s).
  2. Select the layers you want to set a new data source for.
  3. Click the Replace button.
  4. In the Find what text box, define the string or character to find in the current data source.
  5. In the Replace with text box, define the string or character to replace in the current data source.
  6. Click Replace to replace the found string with the new string in the data source connection path.
  7. Click OK to save the output file.
NoteNote:

You can change the data source connection path to a UNIX conform connection path, for example, changing the string \\myserver\ to /net/myserver. In this case, you will not be able to preview the .mxd or .msd file in ArcCatalog because the data sources are not available from a Windows machine. If you want to ensure your new data sources are set correctly, you can use the Map Path Editor to open the .mxd or .msd on UNIX.


7/23/2010