当前位置: 代码迷 >> Oracle管理 >> 连接异常:ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
  详细解决方案

连接异常:ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

热度:347   发布时间:2016-04-24 05:18:17.0
连接错误:ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
我用ado.net去连接oracle出错
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

代码如下
this.connect = new OracleConnection("Data Source=computerName;User Id=system;Password=123456789;");
this.connect.Open();

我的tnsnames.ora如下

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

ORCL =
  (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = computerName)(PORT = 1521))
  (CONNECT_DATA =
  (SERVER = DEDICATED)
  (SERVICE_NAME = orcl)
  )
  )


我再其他客户端使用tnsping computerName都是没有问题的,太奇怪了
谢谢!

------解决方案--------------------
我们的问题有点相似!抱歉,我也解决不了!
------解决方案--------------------
介个不是TNS配置的问题,是Listener木有配对,检查一下呗
------解决方案--------------------
之前我用jdbc连接11g 碰到这样的问题。 11g不能用sid 用server_name 加反斜扛
------解决方案--------------------
搞定了没有,我也碰到这个问题。。我是装了11g odac 10g的oracle
  相关解决方案