<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Register Data Store with Python Failing in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/register-data-store-with-python-failing/m-p/1108765#M62678</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Did you ever get an answer to this question. How was it resolved?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Oct 2021 11:02:00 GMT</pubDate>
    <dc:creator>AprilSummers</dc:creator>
    <dc:date>2021-10-19T11:02:00Z</dc:date>
    <item>
      <title>Register Data Store with Python Failing</title>
      <link>https://community.esri.com/t5/python-questions/register-data-store-with-python-failing/m-p/319052#M24800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ESRI has pointed me to using a python script and a pipe deliminited text file for scripting the registration of data stores with our ArcGIS Server/Portal implementation.&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://server.arcgis.com/en/server/latest/administer/windows/example-register-folders-and-databases-listed-in-a-text-file.htm" rel="nofollow" target="_blank"&gt;http://server.arcgis.com/en/server/latest/administer/windows/example-register-folders-and-databases-listed-in-a-text-file.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The problem is it just won't work.&amp;nbsp; I can log into the manager and use the same .sde files and create the data store manually. I can also do the same with making a connection via ArcCatalog and adding the datastore manually but the python script simply will not work.&amp;nbsp; I've tested all the .ags files the script generates and they connect just fine to ArcGIS Server.&amp;nbsp; I have checked that we have the correct SQL Server Client installed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run the script that is found above from my desktop it errors with the following:&lt;/P&gt;&lt;P&gt;Adding the datastore: winauth@write_stage Adding of the datastore: winauth@write_stage failed. Cannot open server connection to database. Adding the datastore: winauth@vector_stage Adding of the datastore: winauth@vector_stage failed. Cannot open server connection to database.&lt;/P&gt;&lt;P&gt;When I try to run python from the server itself I get this:&lt;/P&gt;&lt;P&gt;Adding the datastore: winauth@write_stage Adding of the datastore: winauth@write_stage failed. Cannot open AGS server connection. Adding the datastore: winauth@vector_stage Adding of the datastore: winauth@vector_stage failed. Cannot open AGS server connection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes on the server it throws up an exception to the certificate I add it to the trusted store but that doesn't provide any relief&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I made sure to use HTTPS and Port 6443 and I've I've tried it with HTTP and 6080 and I've tried it wout any port it is always the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I get the following error in the AGS Log: Token is not a valid Admin token. Trying portal token next. Token = ., referrer = &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://.domain.com/arcgis/manager/log.html#lgf=type%2Ctime%2Cmessage%2Csource&amp;amp;lqlf=DEBUG&amp;amp;lqa=last%2024%20hours&amp;amp;lqs=ALL&amp;amp;lqm=ALLCould" rel="nofollow" target="_blank"&gt;https://.domain.com/arcgis/manager/log.html#lgf=type%2Ctime%2Cmessage%2Csource&amp;amp;lqlf=DEBUG&amp;amp;lqa=last%2024%20hours&amp;amp;lqs=ALL&amp;amp;lqm=ALLCould&lt;/A&gt;&lt;SPAN&gt; not decrypt token. Token may not be valid.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But I can see just above it this error that a token was requested and granted&lt;/P&gt;&lt;P&gt;Thank you in advance for troubleshooting help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 17:02:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/register-data-store-with-python-failing/m-p/319052#M24800</guid>
      <dc:creator>JosephBuckles</dc:creator>
      <dc:date>2015-06-26T17:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Register Data Store with Python Failing</title>
      <link>https://community.esri.com/t5/python-questions/register-data-store-with-python-failing/m-p/319053#M24801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you ever get an answer to this question?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2016 22:54:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/register-data-store-with-python-failing/m-p/319053#M24801</guid>
      <dc:creator>KenHansen1</dc:creator>
      <dc:date>2016-12-14T22:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Register Data Store with Python Failing</title>
      <link>https://community.esri.com/t5/python-questions/register-data-store-with-python-failing/m-p/1108765#M62678</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Did you ever get an answer to this question. How was it resolved?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 11:02:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/register-data-store-with-python-failing/m-p/1108765#M62678</guid>
      <dc:creator>AprilSummers</dc:creator>
      <dc:date>2021-10-19T11:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: Register Data Store with Python Failing</title>
      <link>https://community.esri.com/t5/python-questions/register-data-store-with-python-failing/m-p/1266918#M67059</link>
      <description>&lt;P&gt;I can tell you this, you'll need to use the arcgis API for Python, the link they pointed the initial poster to was for older python functions from Arcmap.&lt;/P&gt;&lt;P&gt;you'll need to get to this&amp;nbsp;hosting_servers=gis.admin.servers.get(role="HOSTING_SERVER") to get a&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;DataStoreManager&lt;/SPAN&gt;&amp;nbsp;= hosting_servers[0].datastoresDataStoreManager&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I used this with a csv containing the parameters&amp;nbsp;&lt;/P&gt;&lt;P&gt;dstores = hosting_servers[0].datastores&lt;/P&gt;&lt;P&gt;inputFile = r"\\mypathto\The.csv"&lt;/P&gt;&lt;P&gt;try:&lt;BR /&gt;with open(inputFile, 'r') as newDSFile:&lt;BR /&gt;DSdict_csv = csv.DictReader(newDSFile)&lt;BR /&gt;for dstore in DSdict_csv:&lt;BR /&gt;&lt;BR /&gt;print("Adding the " + dstore['dsType'] + " datastore: " + dstore['dsName'])&lt;BR /&gt;if dstore['dsType'] == 'FOLDER':&lt;BR /&gt;item = dstores.add_folder(dstore['dsName'],dstore['dsServerPath'])&lt;BR /&gt;if item:&lt;BR /&gt;print(str(item.properties) + '\n')&lt;BR /&gt;elif dstore['dsType'] == 'DATABASE':&lt;BR /&gt;con = dstores.generate_connection_string(dstore['dsServerPath'])&lt;BR /&gt;item = dstores.add_database(dstore['dsName'],con)&lt;BR /&gt;if item:&lt;BR /&gt;print(str(item.properties) + '\n')&lt;BR /&gt;&lt;BR /&gt;except Exception as Ex:&lt;BR /&gt;print(str(Ex))&lt;/P&gt;</description>
      <pubDate>Sun, 12 Mar 2023 20:13:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/register-data-store-with-python-failing/m-p/1266918#M67059</guid>
      <dc:creator>DarylHochhalter</dc:creator>
      <dc:date>2023-03-12T20:13:25Z</dc:date>
    </item>
  </channel>
</rss>

