Visual Studio 2010 Oracle CLR项目 - 无法部署项目(ORA-12154:TNS:无法解析指定的连接标识符)

时间:2013-09-24 10:00:23

标签: c# visual-studio-2010 oracle oracle11g clr

我在我的系统上设置了一个本地Oracle数据库,可以通过SqlDeveloper和Sql * Plus(sqlplus system / mypassword @ ORACLE)连接,但是当我尝试在部署选项中设置ODP.Net connectionstring时一个Visual Studio 2010 CLR项目然后我得到一个ORA-12154:TNS:无法解析指定的连接标识符。

我做的动作: Visual Studio 2010
档案

  • 新项目
  • 数据库
  • 甲骨文
  • Visual C#Oracle Project

构建

  • 部署
  • 启动Oracle部署向导,我在其中创建具有以下细节的新连接:
  • 数据源:Oracle数据库(ODP.NET)
  • 数据源名称:ORACLE
  • 用户名:SYSTEM
  • 通过:mypassword
  • 测试连接
  • ORA-12154:TNS:无法解析指定的conect标识符

我的tnsnames.ora的内容:

# tnsnames.ora Network Configuration File:     c:\app\oracle\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

ORACLE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORACLE)
    )
  )

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

我的listener.ora的内容:

# listener.ora Network Configuration File:     c:\app\oracle\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = c:\app\oracle\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS =     "EXTPROC_DLLS=ONLY:c:\app\oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.domain.com)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = c:\app\oracle

sqlnet.ora的内容:

# sqlnet.ora Network Configuration File:     c:\app\oracle\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

# This file is actually generated by netca. But if customers choose to 
# install "Software Only", this file wont exist and without the native 
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

1 个答案:

答案 0 :(得分:0)

回答我自己的问题:在我的listener.ora中用localhost替换myhost.domain.com解决了这个问题