<?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: Getting HRESULT E_FAIL error when trying to open database connection via connection file in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-hresult-e-fail-error-when-trying-to-open/m-p/1007134#M5826</link>
    <description>&lt;P&gt;Sorry for the late reply ... i just tried this using 2.6 and it worked fine.&amp;nbsp; My sample code has the UriKind.Absolute parameter added in the Uri constructor.&amp;nbsp; Let me know if you still have problems with this and i try it in 2.5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;try
{
		var workspaceConnectionString = await QueuedTask.Run(() =&amp;gt;
		{
				var sdePath = @"\\tsclient\C\Data\FeatureTest\sde-test.sde";
				var dbGdbConnection = new DatabaseConnectionFile(new Uri(sdePath, UriKind.Absolute));
				return new Geodatabase(dbGdbConnection).GetConnectionString();
		});
		MessageBox.Show(workspaceConnectionString);
}
catch (Exception ex)
{
		MessageBox.Show($@"Error: {ex}");
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 05 Dec 2020 00:34:42 GMT</pubDate>
    <dc:creator>Wolf</dc:creator>
    <dc:date>2020-12-05T00:34:42Z</dc:date>
    <item>
      <title>Getting HRESULT E_FAIL error when trying to open database connection via connection file</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-hresult-e-fail-error-when-trying-to-open/m-p/1001144#M5736</link>
      <description>&lt;P&gt;I developed an Addin in AGP 2.5 where I am using connection files to open database connections at runtime. So far that worked perfect. The connection files are stored on a network drive, referenced in the Addin with absolute paths.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;DatabaseConnectionFile connectionFileValidering = new DatabaseConnectionFile(new Uri(AppSettings.Default.sde_validation));&lt;/LI-CODE&gt;&lt;P&gt;Now that I am doing some maintenance on the Addin I am running into the following error when trying to open the enterprise database:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Database test_db = new Database(connectionFileValidation);&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;'Database test_db = new Database(connectionFileValidation)' threw an exception of type 'ArcGIS.Core.Data.GeodatabaseException'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Data: {System.Collections.ListDictionaryInternal}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;HResult: -2146233088&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;HelpLink: null&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;InnerException: {"Error HRESULT E_FAIL has been returned from a call to a COM component."}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Message: "A geodatabase exception has occurred."&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Source: "ArcGIS.Core"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;StackTrace: " at ArcGIS.Core.Data.Database..ctor(DatabaseConnectionFile databaseConnectionFile)"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;TargetSite: {Void .ctor(ArcGIS.Core.Data.DatabaseConnectionFile)}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;With respect to the error message I found some stuff that is not related to ArcGIS, but did not help either.&lt;BR /&gt;Anybody here can point me the direction of a solution?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 10:42:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-hresult-e-fail-error-when-trying-to-open/m-p/1001144#M5736</guid>
      <dc:creator>TomGeo</dc:creator>
      <dc:date>2020-11-13T10:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Getting HRESULT E_FAIL error when trying to open database connection via connection file</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-hresult-e-fail-error-when-trying-to-open/m-p/1007134#M5826</link>
      <description>&lt;P&gt;Sorry for the late reply ... i just tried this using 2.6 and it worked fine.&amp;nbsp; My sample code has the UriKind.Absolute parameter added in the Uri constructor.&amp;nbsp; Let me know if you still have problems with this and i try it in 2.5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;try
{
		var workspaceConnectionString = await QueuedTask.Run(() =&amp;gt;
		{
				var sdePath = @"\\tsclient\C\Data\FeatureTest\sde-test.sde";
				var dbGdbConnection = new DatabaseConnectionFile(new Uri(sdePath, UriKind.Absolute));
				return new Geodatabase(dbGdbConnection).GetConnectionString();
		});
		MessageBox.Show(workspaceConnectionString);
}
catch (Exception ex)
{
		MessageBox.Show($@"Error: {ex}");
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Dec 2020 00:34:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-hresult-e-fail-error-when-trying-to-open/m-p/1007134#M5826</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2020-12-05T00:34:42Z</dc:date>
    </item>
  </channel>
</rss>

