【ArcEngine】AE连接SDE_For_SQLServer参数设置

SDE for sqlserver直连的ArcEngine访问 

Ae中的数据的连接实质还是采用服务连接的方式。连接代码如下: 

 1  public IWorkspace Getworkspace()
 2   {
 3       IPropertySet propertySet = new PropertySetClass();
 4       propertySet.SetProperty("SERVER", "127.0.0.1");  
 5       propertySet.SetProperty("INSTANCE", "sde:sqlserver:127.0.0.1");
 6       propertySet.SetProperty("DATABASE", "sde");
 7       propertySet.SetProperty("USER", "sa");
 8       propertySet.SetProperty("PASSWORD", "sa");
 9       propertySet.SetProperty("VERSION", "SDE.DEFAULT"); 
10     Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
11       IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
12       return workspaceFactory.Open(propertySet, 0);
13  }

 

对于参数INSTANCE,

sde服务状态 参数值
已经启动 "5151" 或者 "sde",或者 “sde:sqlserver:127.0.0.1” 
未启动 “sde:sqlserver:127.0.0.1” 
posted @ 2017-09-22 17:44  vichang  阅读(554)  评论(0编辑  收藏  举报