ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Ayuda
  • Sign Out
ArcGIS Desktop

ArcGIS Online

La plataforma de representación cartográfica para tu organización

ArcGIS Desktop

Un completo SIG profesional

ArcGIS Enterprise

SIG en tu empresa

ArcGIS for Developers

Herramientas para crear aplicaciones basadas en la ubicación

ArcGIS Solutions

Plantillas de aplicaciones y mapas gratuitas para tu sector

ArcGIS Marketplace

Obtén aplicaciones y datos para tu organización.

  • Documentación
  • Soporte
Esri
  • Iniciar sesión
user
  • Mi perfil
  • Cerrar sesión

ArcMap

  • Inicio
  • Introducción
  • Cartografiar
  • Analizar
  • Administrar datos
  • Herramientas
  • Extensiones

AddDataStoreItem

  • Resumen
  • Sintaxis
  • Muestra de código

Resumen

Registers a folder or database with an ArcGIS Server site.

Sintaxis

AddDataStoreItem (connection_file, datastore_type, connection_name, server_path, {client_path}, {hostname})
ParámetroExplicaciónTipo de datos
connection_file

An ArcGIS Server connection file (.ags) representing the server with which you want to register the data. If you've made a connection in ArcCatalog you can use the connection file found in your user profile directory. Alternatively, you can create a connection file from scratch using the function CreateGISServerConnectionFile.

String
datastore_type

The type of data being registered.

  • DATABASE —The data resides in an enterprise database.
  • FOLDER —The data is file-based.
String
connection_name

A name for this folder or database that publishers or administrators will see when they view the server properties.

String
server_path

The path or connection to the data as seen by the server.

If you are registering a DATABASE, this is either the path to a database connection file (.sde) or a string containing the database connection parameters.

If you are registering a FOLDER, this is the path to the folder.

String
client_path

The path or connection to the data as seen by the publisher's machine, if different from the information used by the server. In some cases the publisher and the server may be referencing physically distinct databases or folders. When you provide the publisher path and the server path, ArcGIS Server automatically corrects the paths at publish time when your map documents and other resources are transferred to the server.

If you are registering a DATABASE, provide either the path to a database connection file (.sde) or a string containing the database connection parameters.

If you are registering a FOLDER, provide the path to the folder.

If you are registering ArcGIS Server's Managed Database, do not provide a path; instead, provide the string managed for this parameter. ArcGIS Server's Managed Database is an enterprise geodatabase you designate where data can be copied at publish time if a user attempts to publish a feature service from an unregistered data location.

String
hostname

The name of the publisher or client machine that will use this registered folder or database. If left blank, the name of the machine running the script will be used.

String

Valor de retorno

Tipo de datosExplicación
String

If successful, returns the string "Success".

Muestra de código

Register a folder used by both the server and publisher

Registers a local folder C:\temp with ArcGIS Server. Assumes that a connection to the server has been created in the Catalog window of ArcMap and renamed MyConnection.

import arcpy

conn = "GIS Servers/MyConnection.ags"
path = "c:/temp"

arcpy.AddDataStoreItem(conn, "FOLDER", "My local data folder", path, path)
Register a folder that differs between the server and publisher

Registers a shared folder \\MYSERVER\mydata\Washington with the server, with the local folder C:\mydata\Washington being used by the publisher.

import arcpy

conn = "c:/connections/MYSERVER.ags"

arcpy.AddDataStoreItem(conn, "FOLDER", "Washington",
                       "//MYSERVER/mydata/Washington",
                       "c:/mydata/Washington", "MYPUBLISHER")
Register a database used by both the server and publisher

Registers an enterprise database wilma used by both the server and the publisher machines. Uses an .sde connection file, created when you add a database connection in the Catalog window of ArcMap.

import arcpy

server_conn = "c:/connections/MYSERVER.ags"
db_conn = "c:/connections/Connection to wilma.sde"

arcpy.AddDataStoreItem(server_conn, "DATABASE", "Wilma", db_conn, db_conn)
Register a database that differs between the server and publisher

Registers an enterprise database wilma with the server, with the database pebbles being used by the publisher.

import arcpy

server_conn = "c:/connections/MYSERVER.ags"
db_conn_serv = "c:/connections/Connection to wilma.sde"
db_conn_pub = "c:/connections/Connection to pebbles.sde"

arcpy.AddDataStoreItem(
    server_conn, "DATABASE", "WilmaAndPebbles", db_conn_serv, db_conn_pub)
Register a database as ArcGIS Server's Managed Database

Registers an enterprise database wilma as ArcGIS Server's Managed Database. If a publisher attempts to publish a feature service from an unregistered data location, the data will be copied here.

import arcpy

server_conn = "c:/connections/MYSERVER.ags"
db_conn_serv = "c:/connections/Connection to wilma.sde"

arcpy.AddDataStoreItem(
    server_conn, "DATABASE", "WilmaManaged", db_conn_serv, "managed")
Register a database using a connection string

Registers an enterprise database serverX with the server using a database connection string.

import arcpy

server_conn = "c:/connections/MYSERVER.ags"

db_conn_string = u"PASSWORD=pwdX;SERVER=serverX;" + \
                 u"INSTANCE=sde:sqlserver:serverX;DBCLIENT=sqlserver;" + \
                 u"DB_CONNECTION_PROPERTIES=serverX;" + \
                 u"DATABASE=sde;USER=userX;AUTHENTICATION_MODE=DBMS"
                           
arcpy.AddDataStoreItem(
    server_conn, "DATABASE", "ServerX", db_conn_string, db_conn_string)

Temas relacionados

  • ListDataStoreItems
  • RemoveDataStoreItem
  • ValidateDataStoreItem

ArcGIS Desktop

  • Inicio
  • Documentación
  • Soporte

Plataforma ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

Acerca de Esri

  • Quiénes somos
  • Empleo
  • Blog de Esri
  • Conferencia de usuarios
  • Cumbre de desarrolladores
Esri
Díganos su opinión.
Copyright © 2019 Esri. | Privacidad | Legal