bruce_chou
路人甲
路人甲
  • 注册日期2003-10-10
  • 发帖数23
  • QQ
  • 铜币113枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2260回复:8

SDE连接问题

楼主#
更多 发布于:2004-06-15 09:45
<P>各位大哥大姐,小弟有一个问题搞不明白,希望大伙帮帮忙.就是MO连接SDE的时候所涉及的几个参数(Server,User,PassWord,DataBase)与ArcCatolog连接SDE的时候所涉及的几个参数(Server,Service,Database,User Name,PassWord)是怎么的一个对应关系.我用后者连接SDE一点问题都没有,但使用MO的时候不知如何设置,总是连接不上.</P>
<P> 那位高人请指点一二,这里先多谢了!</P>
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15947
  • QQ554730525
  • 铜币25339枚
  • 威望15364点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2004-06-15 10:03
<P 0cm 0cm 0pt"><FONT size=2>如果你使用的是<FONT face="Times New Roman">MO</FONT>,那么我们也可以很容易地与<FONT face="Times New Roman">ArcSDE</FONT>进行连接,而且在<FONT face="Times New Roman">MO2.1</FONT>中也提供了直接连接的方式。我们可以新建一个标准<FONT face="Times New Roman">VB</FONT>工程,也可以在<FONT face="Times New Roman">ArcMap</FONT>或<FONT face="Times New Roman">ArcCatalog</FONT>的<FONT face="Times New Roman">VBA</FONT>中添加一个窗体,然后在<FONT face="Times New Roman">Form_Click</FONT>事件下写入相应的代码并进行测试。下面我们就看看它们的区别。</FONT></P><P 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; mso-char-indent-count: 0; mso-char-indent-size: 0cm; mso-list: l1 level1 lfo3; tab-stops: list 36.0pt"><FONT size=2>(1)       应用服务器连接</FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman" size=2>Private Sub Form_Click()</FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2> <p></p></FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    Dim dc As MapObjects2.DataConnection</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    Set dc = New MapObjects2.DataConnection</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman" size=2>    </FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    With dc</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>        .Server = "sde81:legend"</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>        .Database = "instance=esri_sde"</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>        .User = "zhj"</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>        .Password = "zhj"</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    End With</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman" size=2>    </FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    If dc.Connect Then</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>        MsgBox "OK"</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    Else</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>        MsgBox "Error"</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    End If</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman" size=2>End Sub</FONT></P><P 0cm 0cm 0pt"><FONT size=2>这段代码的核心部分就是对<FONT face="Times New Roman">dc</FONT>属性的设置。<FONT face="Times New Roman">Server</FONT>设置为<FONT face="Times New Roman">sde81:legend</FONT>,<FONT face="Times New Roman">sde81</FONT>指的是使用<FONT face="Times New Roman">SDE8.x</FONT>版本的<FONT face="Times New Roman">DLL</FONT>去连接,当然在<FONT face="Times New Roman">MO2.1</FONT>中还提供了<FONT face="Times New Roman">sde30</FONT>和<FONT face="Times New Roman">sde80</FONT>,这就要根据实际情况来选择了;服务器名与前面相同;<FONT face="Times New Roman">Database</FONT>与前面提到的<FONT face="Times New Roman">Service</FONT>是一致的,只是在写法上有些区别,你可以写成<FONT face="Times New Roman">Database = "instance=esri_sde"</FONT>,也可以写成<FONT face="Times New Roman">Database = "esri_sde"</FONT>;用户和密码是不可少的。</FONT></P><P 0cm 0cm 0pt 36pt; TEXT-INDENT: -36pt; mso-char-indent-count: 0; mso-char-indent-size: 0cm; mso-list: l1 level1 lfo3; tab-stops: list 36.0pt"><FONT size=2>(2)       直接连接</FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman" size=2>Private Sub Form_Click()</FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    Dim dc As MapObjects2.DataConnection</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    Set dc = New MapObjects2.DataConnection</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman" size=2>    </FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    With dc</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>        .Server = "sde81:"</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>        .Database = "instance=sde:oracle"</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>        .User = "zhj"</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>        .Password = "zhj@sde8"</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    End With</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman" size=2>    </FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    If dc.Connect Then</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>        MsgBox "OK"</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    Else</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>        MsgBox "Error"</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman"><FONT size=2>    End If</FONT></FONT></P><P 0cm 0cm 0pt"><FONT face="Times New Roman" size=2>End Sub</FONT></P><P 0cm 0cm 0pt"><FONT size=2>在此设置<FONT face="Times New Roman">Server</FONT>时,虽然可以省略服务器的名称,但<FONT face="Times New Roman">sde81:</FONT>是不可少的,因为它指明了要使用的<FONT face="Times New Roman">DLL</FONT>;<FONT face="Times New Roman">Database</FONT>只能是上面的写法,不可省略<FONT face="Times New Roman">instance=</FONT>;用户和密码同前。这就是<FONT face="Times New Roman">MO</FONT>的连接方式。</FONT></P>
举报 回复(0) 喜欢(0)     评分
bruce_chou
路人甲
路人甲
  • 注册日期2003-10-10
  • 发帖数23
  • QQ
  • 铜币113枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2004-06-15 10:44
还是不行
谢谢GIS兄,我按照GIS兄的例子试验了一下,还是不行,总是提示 "No SDE entry in the etc/service file"顺便说一句,我用的是mo2.0,例子是安装路径里sample中的"SDE Connection"
[此贴子已经被作者于2004-6-15 10:45:35编辑过]
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15947
  • QQ554730525
  • 铜币25339枚
  • 威望15364点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
3楼#
发布于:2004-06-15 10:53
你需要修改service文件,如果修改了还不行,你可以把sde81改为sde83看看
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15947
  • QQ554730525
  • 铜币25339枚
  • 威望15364点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
4楼#
发布于:2004-06-15 10:54
修改Windows配制文件 首先在c:\winnt\system32\drivers\ect目录下找到 services文件,使用记事本打开,在最后加一行 esri_sde 5151/tcp #ArcSDE
举报 回复(0) 喜欢(0)     评分
bruce_chou
路人甲
路人甲
  • 注册日期2003-10-10
  • 发帖数23
  • QQ
  • 铜币113枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2004-06-15 13:17
不好意思
<P>GIS兄,不好意思又打扰了,在services文件里已经有那一行了,但是还是连接不上,不过这次的提示有了变化"not found Server Machine"</P>
<P>我的设置如下:</P>
<P>dc.Server = "sde81:wwq" //"sde83:wwq"我也试过</P>
<P>dc.Database = "esri_sde"</P>
<P>dc.user = "sde"</P>
<P>dc.Password = "sde"</P>
<P>其中,wwq是安装Sde的机器名</P>
<P>麻烦GIS兄给分析一下问题出在那里,欢迎别的兄弟姐妹们一起讨论</P>
[此贴子已经被作者于2004-6-15 13:27:28编辑过]
举报 回复(0) 喜欢(0)     评分
moxili
路人甲
路人甲
  • 注册日期2005-05-11
  • 发帖数6
  • QQ
  • 铜币141枚
  • 威望0点
  • 贡献值0点
  • 银元0个
6楼#
发布于:2005-05-20 01:02
我也出现楼上问题,兄台们给小第指点一下,急需!!!
举报 回复(0) 喜欢(0)     评分
moxili
路人甲
路人甲
  • 注册日期2005-05-11
  • 发帖数6
  • QQ
  • 铜币141枚
  • 威望0点
  • 贡献值0点
  • 银元0个
7楼#
发布于:2005-05-23 09:04
<P>关注中..........</P>
举报 回复(0) 喜欢(0)     评分
G!s
G!s
路人甲
路人甲
  • 注册日期2004-06-22
  • 发帖数76
  • QQ
  • 铜币269枚
  • 威望0点
  • 贡献值0点
  • 银元0个
8楼#
发布于:2005-06-02 18:50
<P>dcSDE.Database = "Instance=" ; txtService.Text ; ";Database=" ; txtDatabase.Text</P>
<P>比如:若SDE服务为默认的"ESRI_SDE" ,Oracle全局数据库为"PLIS"则:</P>
<P>dcSDE.Database = "Instance = ESRI_SDE ;Database = PLIS"</P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部