<?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: ArcGIS Pro SDK C#: Create a Database Connection in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-c-create-a-database-connection/m-p/1138156#M7707</link>
    <description>&lt;P&gt;Are the "Randomly Assigned" tables not even contained in the database you are connecting to?&amp;nbsp; Can you send images of success (in geoprocessing window) and failure (using the add-in)?&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jan 2022 22:12:09 GMT</pubDate>
    <dc:creator>KimberlyGarbade</dc:creator>
    <dc:date>2022-01-27T22:12:09Z</dc:date>
    <item>
      <title>ArcGIS Pro SDK C#: Create a Database Connection</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-c-create-a-database-connection/m-p/1138122#M7706</link>
      <description>&lt;P&gt;I was just going to leave this as a minor thing, but it's getting really cumbersome.&amp;nbsp; When I use the geoprocessing tool, "CreateDatabaseConnection_management", to create an SDE connection in my Add-In app, the connected SDE geodatabase is populated with "randomly-assigned" tables, instead of the actual tables contained in the database.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Running the tool in the Geoprocessing tab, however, the SDE database connection is populated with correct tables.&amp;nbsp; Is this a bug in the SDK?&amp;nbsp; Below is my code snippet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//Create a new sde connection
try
{  
    ProgressDialog progDlg = new ProgressDialog("Creating Database Connection...", "Cancel", 100, true);
    progDlg.Show();

    //Execute a GP tool
    IReadOnlyCollection&amp;lt;string&amp;gt; args = Geoprocessing.MakeValueArray(workDir, connName, server, instance, "OPERATING_SYSTEM_AUTH", dbName, sdePath);
    IGPResult gp_result = await Geoprocessing.ExecuteToolAsync("CreateDatabaseConnection_management", Geoprocessing.MakeValueArray(args.ToArray()),
                                                null, new CancelableProgressorSource(progDlg).Progressor, GPExecuteToolFlags.Default);
    }
catch (Exception ex)
{
	ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to create database connection: " + ex.Message, "Error Message", MessageBoxButton.OK, MessageBoxImage.Error);
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 27 Jan 2022 21:22:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-c-create-a-database-connection/m-p/1138122#M7706</guid>
      <dc:creator>JadedEarth</dc:creator>
      <dc:date>2022-01-27T21:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro SDK C#: Create a Database Connection</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-c-create-a-database-connection/m-p/1138156#M7707</link>
      <description>&lt;P&gt;Are the "Randomly Assigned" tables not even contained in the database you are connecting to?&amp;nbsp; Can you send images of success (in geoprocessing window) and failure (using the add-in)?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2022 22:12:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-c-create-a-database-connection/m-p/1138156#M7707</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-01-27T22:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro SDK C#: Create a Database Connection</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-c-create-a-database-connection/m-p/1138345#M7709</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Please the attached images.&amp;nbsp; As you can see, in my Add-In:&lt;/P&gt;&lt;P&gt;1. Users select the allowed database connection they can create.&lt;/P&gt;&lt;P&gt;2. Then they click the "Run" button.&lt;/P&gt;&lt;P&gt;3.&amp;nbsp; The SDE Connection is created in the working folder.&amp;nbsp; But if you expand the name, you'd see the tables are not the tables for the selected database.&lt;/P&gt;&lt;P&gt;4. As a workaround, I make the user click "Connection Properties" (image 4) and reselect the database.&lt;/P&gt;&lt;P&gt;5.&amp;nbsp; Then back at the Catalog pane, they click "Refresh" to show the actual tables for that database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why doesn't it just show the actual tables connected with the database?&amp;nbsp; The workaround is so cumbersome and some users may not follow the instructions I provided in the GUI.&amp;nbsp; Who wants to read those?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1_CreateSDE_Connection.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32584iB17247A64AF7585A/image-size/large?v=v2&amp;amp;px=999" role="button" title="1_CreateSDE_Connection.JPG" alt="1_CreateSDE_Connection.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2_ClickRun.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32585iFA44C536720B7EEF/image-size/large?v=v2&amp;amp;px=999" role="button" title="2_ClickRun.JPG" alt="2_ClickRun.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3_SDEConnection_created.JPG" style="width: 503px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32587i6BC4D0D6F4D2C8FA/image-size/large?v=v2&amp;amp;px=999" role="button" title="3_SDEConnection_created.JPG" alt="3_SDEConnection_created.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="4_Workaround_Conection_properties.JPG" style="width: 831px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32588iACA3B2B2494A860C/image-size/large?v=v2&amp;amp;px=999" role="button" title="4_Workaround_Conection_properties.JPG" alt="4_Workaround_Conection_properties.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="5_ClickRefreshInCatalog.JPG" style="width: 594px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32589i055FAA3D5E34542E/image-size/large?v=v2&amp;amp;px=999" role="button" title="5_ClickRefreshInCatalog.JPG" alt="5_ClickRefreshInCatalog.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 14:33:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-c-create-a-database-connection/m-p/1138345#M7709</guid>
      <dc:creator>JadedEarth</dc:creator>
      <dc:date>2022-01-28T14:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro SDK C#: Create a Database Connection</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-c-create-a-database-connection/m-p/1138521#M7711</link>
      <description>&lt;P&gt;Hmmm... so no matter what the user chooses (like if&amp;nbsp; they type or choose "GIS_TMP") they are initially connected to the "CEAP_Routed_Output" database instead...&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a post that addresses a similar situation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-questions/python-script-using-arcpy-createdatabaseconnection/td-p/159152" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/python-questions/python-script-using-arcpy-createdatabaseconnection/td-p/159152&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I think it is saying that you have to fully quality the inputs your putting in your MakeValueArray.&amp;nbsp; For example rather than populating the array with &lt;STRONG&gt;&lt;EM&gt;SQL_SERVER&lt;/EM&gt;&lt;/STRONG&gt; you would use &lt;EM&gt;&lt;STRONG&gt;database_platform="SQL_SERVER"&lt;/STRONG&gt;&lt;/EM&gt;.&amp;nbsp; I think the post is suggesting that since the optional inputs into the CreateDatabaseConnection_management function are being left blank, python needs the fully qualified inputs to know which array values are used to populate which parameters of the function.&amp;nbsp; Sounds just crazy enough to work.&lt;/P&gt;&lt;P&gt;The only other thing I can think of is that when your using the function from the app it isn't overwriting a current connection file having the same name as the one you are creating; and that existing file is pointed at "CEAP_Routed_Output".&amp;nbsp; You might try setting overwriteoutput to true in your script or deleting any existing connection file with the same name in the same folder before creating the new one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 22:00:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-c-create-a-database-connection/m-p/1138521#M7711</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-01-28T22:00:14Z</dc:date>
    </item>
  </channel>
</rss>

