Oracle-11g-R2

通過 Visual Studio 連接 Oracle

  • June 19, 2018

我在我的機器上安裝了 oracle 客戶端 11.2.0 版本,還為 Visual Studio 安裝了 Oracle 數據訪問提供程序。我還安裝了 Oracle 數據訪問 11.2.0.3.20。我正在嘗試通過 Visual Studio 連接到數據庫,但出現以下異常

ORA -12504 : TNS: listner was not given the SERVICE_NAME in CONNECT_DATA**

tnsnames.ora 文件包含以下程式碼

creds=
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = aaa.cedd.net)(PORT = 1521))
   )
   (CONNECT_DATA =
     (SID = creds)
   )
 )

只需更改SIDSERVICE_NAME

creds=
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = aaa.cedd.net)(PORT = 1521))
   )
   (CONNECT_DATA =
     (SERVICE_NAME = creds)
   )
 )

它可能沒有載入您認為它正在載入的 TNSNAMES.ORA 文件。而是更喜歡Easy Connect Naming。這裡像’//aaa.cedd.net/creds'

引用自:https://dba.stackexchange.com/questions/125187