AnsweredAssumed Answered

connect to geodatabase arcobjects

Question asked by Nadir_Hussain on Jul 15, 2020
Latest reply on Jul 20, 2020 by Nadir_Hussain

Dear All,

we have geodatabase in 10.5 and sql server 2016.i have to write one web service.before we connect to geodatabase when arcsde application server insatlled.But after 10.3 ESRI obselete ARCSDE server.so in my new enviornment i dont have SDE server installation.below function return worksapce in old envirnment.But SDE finish.I cant connect to geodatabase in new enviornemt.so how to connect to geodatabse without SDE server installation

 

Thanks.

Below code through exception SDE not running.How to solve this in 10.5 arcobjects SDK my geodatabase is in 2016 sq server.i know sdeserver  not install.But i want to connect to geodattabase without sde server.

private IWorkspace getWorkspace()
{

ESRI.ArcGIS.esriSystem.AoInitialize aoInit = null;
esriLicenseStatus licStatus;
IWorkspace workspace = null;
string status = "";
try
{
Console.WriteLine("Obtaining license");
if (ESRI.ArcGIS.RuntimeManager.ActiveRuntime == null)
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
aoInit = new ESRI.ArcGIS.esriSystem.AoInitialize();
licStatus = aoInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeStandard);
if (licStatus == esriLicenseStatus.esriLicenseCheckedOut)
{
Console.WriteLine("Ready with license.");
if (ESRI.ArcGIS.RuntimeManager.ActiveRuntime == null)
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
IPropertySet propertySet = new PropertySet();

propertySet.SetProperty("SERVER", "IP");
propertySet.SetProperty("INSTANCE", "5151");
propertySet.SetProperty("DATABASE", "database");
propertySet.SetProperty("USER", "user");
propertySet.SetProperty("PASSWORD", "user");
propertySet.SetProperty("Authentication_mode", "DBMS");
propertySet.SetProperty("VERSION", "SDE.DEFAULT");
Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
workspace = workspaceFactory.Open(propertySet, 0);
if (workspace != null) {
return workspace;
}

}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
status = ex.Message.ToString()+" "+ex.Source;
}
return workspace;
}

Outcomes