ArcEngine10.1直连Oracle
Posted GISER_Jingkun.liu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ArcEngine10.1直连Oracle相关的知识,希望对你有一定的参考价值。
好久没写AE的东西了,好多东西都忘记了,这里记录一下直连Oracle,注意instance的拼接。
/// <summary> /// 连接Oracle数据库SDE /// </summary> /// <param name="sAddress">连接IP</param> /// <param name="sInstance">数据库实例名orcl</param> /// <param name="sUser">用户名</param> /// <param name="sPassword">密码</param> /// <returns></returns> public IWorkspace Con2OracleSDE(string sAddress, string sInstance, string sUser, string sPassword) IWorkspaceFactory pSdeWksFactory = new SdeWorkspaceFactory(); IWorkspace pWorkspace = null; try IPropertySet propSet = new PropertySetClass(); propSet.SetProperty("server", sAddress); //propSet.SetProperty("instance", "sde:oracle11g:" + sAddress + @"/" + sDBName); //propSet.SetProperty("instance", "sde:oracle11g:" + sDBName); propSet.SetProperty("instance", "sde:oracle11g$//" + sAddress + "/" + sInstance); propSet.SetProperty("user", sUser); propSet.SetProperty("password", sPassword); propSet.SetProperty("version", "SDE.DEFAULT"); pWorkspace = pSdeWksFactory.Open(propSet, 0); return pWorkspace; catch (Exception ex) return null;
另外也可以通过ArcCatalog中配置的数据库连接(.sde文件)进行数据库连接。
以上是关于ArcEngine10.1直连Oracle的主要内容,如果未能解决你的问题,请参考以下文章
ArcEngine10.1 的runtime在哪里有呢?或者基于它的程序怎么打包部署?急求
ArcGIS Runtime和ArcEngine Runtime的区别