直连式
IWorkspace pWkspace = null;
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2 workspaceFactory = null;
ESRI.ArcGIS.esriSystem.IPropertySet pPropertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass();
pPropertySet.SetProperty("SERVER", "lingy");
pPropertySet.SetProperty("INSTANCE", "sde:oracle11g:orcl");
pPropertySet.SetProperty("AUTHENTICATION_MODE","DBMS");
pPropertySet.SetProperty("USER", "sde");
pPropertySet.SetProperty("PASSWORD", "sde");
pPropertySet.SetProperty("VERSION", "SDE.DEFAULT");
workspaceFactory =(ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2)newESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();
pWkspace =workspaceFactory.Open(pPropertySet, 0);
服务式
IWorkspace pWkspace = null;
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2 workspaceFactory = null;
ESRI.ArcGIS.esriSystem.IPropertySet pPropertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass();
pPropertySet.SetProperty("SERVER", "lingy");
pPropertySet.SetProperty("INSTANCE", "esri_sde");
pPropertySet.SetProperty("DATABASE", "orcl");
pPropertySet.SetProperty("USER", "sde");
pPropertySet.SetProperty("PASSWORD", "sde");
pPropertySet.SetProperty("VERSION", "SDE.DEFAULT");
workspaceFactory =(ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2)newESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();
pWkspace =workspaceFactory.Open(pPropertySet, 0);
连接文件式
IWorkspace pWkspace = null;
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory workspaceFactory = null;
workspaceFactory =(ESRI.ArcGIS.Geodatabase.IWorkspaceFactory)newESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();
pWkspace =workspaceFactory.OpenFromFile(@"C:\Users\Administrator\Documents\ArcGIS\Connection.sde", 0);
连接字符串式
string connectionString = "SERVER=lingy;DATABASE=orcl;INSTANCE=5151;USER=sde;PASSWORD=sde;VERSION=sde.DEFAULT";
//connectionString="INSTANCE=sde:oracle11g:orcl;USER=sde;PASSWORD=sde;VERSION=sde.DEFAULT";
IWorkspace pWkspace = null;
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2 workspaceFactory = null;
workspaceFactory =(ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2)newESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();
pWkspace = workspaceFactory.OpenFromString(connectionString,0);
ArcGIS SDE连接方式
本文介绍了使用ArcGIS通过四种不同方式连接SDE (Spatial Database Engine) 的方法:直连式、服务式、连接文件式及连接字符串式。每种方式都详细展示了设置连接属性的具体步骤。
494

被折叠的 条评论
为什么被折叠?



