码迷,mamicode.com
首页 > 数据库 > 详细

C#代码访问oracle数据库

时间:2014-12-07 16:25:18      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:des   style   io   ar   os   sp   on   文件   数据   

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

bubuko.com,布布扣

 

bubuko.com,布布扣若成功则能够连接成功

 

服务器开启但无法成功连接(即能够ping通,但无法访问SDE)

可能原因:

服务器没有启动SDE 以及ORACLE相关服务

解决方法

启动oracle sde相关服务:

cmd->services.msc 将arcsde服务启动,将oracle相关服务启动

C#代码访问oracle数据库

标签:des   style   io   ar   os   sp   on   文件   数据   

原文地址:http://www.cnblogs.com/nightcatcher/p/4149495.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!