C#代码访问oracle数据库
1 引用System.Data.OracleClient
路径:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.OracleClient.dll
2 安装Oracle client
1 官网下载
win32_11gR2_client.zip
注意版本及安装步骤。
2配置文件 sqlnet.ora tnsnames.ora
路径:本机为: D:\app\Administrator\product\11.2.0\client_1\network\admin\sqlnet.ora
注意oracle client的安装路径
内容
sqlnet.ora:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
tnsnames.ora:
SDEORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = VASTSCENE_XP_01)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = sdeorcl)
)
)
SDE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = VASTSCENE_XP_01)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.20)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
3 安装PLSQL Developer
服务器开启但无法成功连接(即能够ping通,但无法访问SDE)
可能原因:
服务器没有启动SDE 以及ORACLE相关服务
解决方法
启动oracle sde相关服务:
cmd->services.msc 将arcsde服务启动,将oracle相关服务启动
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。