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;
}
Solved! Go to Solution.
propertySet.SetProperty("SERVER", "IP");
propertySet.SetProperty("INSTANCE", "sde:sqlServer:ServerName");-----this is the line i change
propertySet.SetProperty("DATABASE", "database");
propertySet.SetProperty("USER", "user");
propertySet.SetProperty("PASSWORD", "user");
propertySet.SetProperty("Authentication_mode", "DBMS");
propertySet.SetProperty("VERSION", "SDE.DEFAULT");
Its working like above settings.
Thanks
Hi Nadir
You use direct connect.
The help is not very updated but you use the same method as for workgroup sde database.
Check here: How to connect to a geodatabase—ArcObjects 10.4 Help for Java | ArcGIS for Desktop
Check the ArcMap connect doc, it is basicaly the same Connect to Microsoft SQL Server from ArcGIS—Help | Documentation
Have fun
propertySet.SetProperty("SERVER", "IP");
propertySet.SetProperty("INSTANCE", "sde:sqlServer:ServerName");-----this is the line i change
propertySet.SetProperty("DATABASE", "database");
propertySet.SetProperty("USER", "user");
propertySet.SetProperty("PASSWORD", "user");
propertySet.SetProperty("Authentication_mode", "DBMS");
propertySet.SetProperty("VERSION", "SDE.DEFAULT");
Its working like above settings.
Thanks