Hi,
I'm developing a SOE to open a connection to a specific workspace using IWorkspaceFactory. I'm using a PostgreSQL geodatabase. Below is my code:
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory"));
IPropertySet propertySet = new PropertySetClass();
propertySet.SetProperty("SERVER", "vmsql201764.nco.inet");
propertySet.SetProperty("INSTANCE", "vmsql201764.nco.inet");
propertySet.SetProperty("DATABASE", "sde");
propertySet.SetProperty("USER", "sde");
propertySet.SetProperty("PASSWORD", sdePassword);
propertySet.SetProperty("AUTHENTICATION_MODE", "DBMS");
propertySet.SetProperty("VERSION", versionName);IWorkspace workspace = workspaceFactory.Open(propertySet, 0);
It throws an Exception with message: "This operation is not allowed".
Any idea? Thank you.
Regards,
Mario Petta
propertySet.SetProperty("VERSION", versionName);
the version name must be SDE.DEFAULT or a child version of SDE.
you can create a geodatabase connection file with the same parameters in ArcGIS Pro to test the connection to the geodatabase.
I'm trying both with the SDE.DEFAULT version and with a child version of sde, but the error persists.
I will try using a connection file with the same parameters, to ensure all is ok with the connection to DB.
Creating a geodatabase connection file in ArcGIS Pro with the same parameters works, but the code above throws an Exception. Any other suggestion?
MP
As a workaround, I created a geodatabase connection file on the server, through ArcGIS Pro. Then, in the SOE source code I opened an IWorkspace with IWorkspaceFactory.OpenFromFile and it worked.
Glad is working now.