Error 0x80041538 in IWorkspaceFactory.Open

3915
2
Jump to solution
05-16-2012 04:24 AM
Luciano_BonifacioRodrigues
New Contributor
Hello everyone!
I created a connection in ArcCatalog (version 10) to access a spatial database remotely through a VPN. ArcCatalog connects to the database SUCCESSFULLY.
Below are the properties of the connection:
Server: <empty> Service: sde:Oracle11g:/;LOCAL=ORADEV Database: <empty>  Database connection Username: theUser Password: thePass  Save username and password. Version: sde.DEFAULT  Save the transactional version file name with the connection.


But when using the same settings to connect to the database via a C# program, throws an COMException with the code 0x80041538 and error description "Underlying DBMS error [Unknown errorNo extended error.]".
I tried using the file (.sde), created by ArcCatalog (and successfully connection), but the program causes the same exception.
Below is the source in C#.
Can anyone help me?
Thank you very much!
-- Luciano.

using System; using System.Collections.Generic; using System.Linq; using System.Text; using ESRI.ArcGIS.Geodatabase; using ESRI.ArcGIS.esriSystem; using ESRI.ArcGIS.DataSourcesGDB; using ESRI.ArcGIS.DataManagementTools; using ESRI.ArcGIS.Geometry; using ESRI.ArcGIS.GeoDatabaseDistributed; using ESRI.ArcGIS; using ESRI.ArcGIS.TrackingAnalyst; using ESRI.ArcGIS.Server;  namespace testearc_sharp  {     class Program      {         [STAThread()]         static void Main(string[] args)    {             IAoInitialize a = new AoInitialize();             RuntimeManager.Bind(ProductCode.Engine);             try             {                 IWorkspace ws = null;                 IPropertySet pPropSet = new PropertySetClass();                 IWorkspaceFactory pSdeFact = new SdeWorkspaceFactoryClass();                 /*                  * Another way, using de .sde from ArcCatalog. Same error.                  *                                    pPropSet = pSdeFact.ReadConnectionPropertiesFromFile("D:/Users/ArcGISSOM/AppData/Roaming/ESRI/Desktop10.0/ArcCatalog/ORADEV.sde");                                    */                 pPropSet.SetProperty("INSTANCE",    @"sde:oracle11g:/;LOCAL=ORADEV");                 pPropSet.SetProperty("USER",        "theUser");                 pPropSet.SetProperty("PASSWORD",    "thePass");                 pPropSet.SetProperty("VERSION",     "sde.DEFAULT");                 pPropSet.SetProperty("AUTHENTICATION_MODE", "DBMS");                  ws = pSdeFact.Open(pPropSet, 0); // ### COMException ERROR ###             }             catch (Exception ex)             {                 Console.WriteLine("exception occurred");                 Console.WriteLine(ex.Message);                 Console.WriteLine(ex.StackTrace);             }             Console.WriteLine("finished, press key");             Console.ReadKey();             a.Shutdown();         }     } }
0 Kudos
1 Solution

Accepted Solutions
NeilClemmons
Regular Contributor III
I see where you're binding to the Engine product and I see where you create a new instance of AoInitialize but I don't see where you're actually checking out a license.  If you haven't checked out a license then your code will fail.

View solution in original post

0 Kudos
2 Replies
NeilClemmons
Regular Contributor III
I see where you're binding to the Engine product and I see where you create a new instance of AoInitialize but I don't see where you're actually checking out a license.  If you haven't checked out a license then your code will fail.
0 Kudos
Luciano_BonifacioRodrigues
New Contributor
Thanks for your response.
In this issue of the license did not check it, I also copied the dlls from Oracle Client into the 'Debug' folder of my application. For some inexplicable reason, the program could not connect to database.
After deleting the dlls and check the license, the program ran successfully.

I really appreciate the time it takes you to my topic.
Regards to all.
--Luciano.
0 Kudos