熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

Pro*c鏈接oracle數據庫

2022-06-13   來源: Oracle 

  [oracle]Pro*c鏈接oracle數據庫

  一程序鏈接oracle數據庫




EXEC SQL CONNECT :DbUser IDENTIFIED BY :DbPasswd USING :DbServer;

  其中DbServer為UCRC

  查文件未發現一IP地址的定義如何鏈接的遠端數據庫?

  

  tnsnamesora 文件的存放路徑為 $ORACLE_HOME/network/admin 以下是一個示例














































  OIDLOCALDOMAIN =
  (DESCRIPTION =
   (ADDRESS_LIST =
   (ADDRESS = (PROTOCOL = TCP)(HOST = localhostlocaldomain)(PORT =
  ))
   )
   (CONNECT_DATA =
   (SERVICE_NAME = oid)
   )
  )
  CAMSLOCALDOMAIN =
  (DESCRIPTION =
   (ADDRESS_LIST =
   (ADDRESS = (PROTOCOL = TCP)(HOST = localhostlocaldomain)(PORT =
  ))
   )
   (CONNECT_DATA =
   (SERVICE_NAME = cams)
   )
  )
  INST_HTTPLOCALDOMAIN =
  (DESCRIPTION =
   (ADDRESS_LIST =
   (ADDRESS = (PROTOCOL = TCP)(HOST = localhostlocaldomain)(PORT =
  
  ))
   )
   (CONNECT_DATA =
   (SERVER = SHARED)
   (SERVICE_NAME = MODOSE)
   (divSENTATION =//admin)
   )
   )
  EXTPROC_CONNECTION_DATALOCALDOMAIN =
   (DESCRIPTION =
   (ADDRESS_LIST =
   (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
   )
   (CONNECT_DATA =
   (SID = PLSExtProc)
   (divSENTATION = RO)
   )
   )

  說明

  tnsnamesora 文件中定義一個或多個網絡服務 net service cams 實例對應的網絡服務為















  CAMSLOCALDOMAIN =
  (DESCRIPTION =
   (ADDRESS_LIST =
   (ADDRESS =
   (PROTOCOL = TCP)
   (HOST = localhostlocaldomain)
   (PORT = ))
   )
   (CONNECT_DATA =
   (SERVICE_NAME = cams)
   )
  )

  注意 這裡 ADDRESS項包含三個子參數

  PROTOCOL 默認協議TCP

  HOST :ip地址

  PORT端口默認

  CAMSLOCALDOMAIN為數據名

  要確保在監聽文件中也有對應的一個 ADDRESS 項也包含同樣的三個子參

  數 並且子參數的值對應都相等 另外 這裡 SERVICE_NAME 的值必需確

  保與監聽文件中某 SID_DESC項下的 SID_NAME參數的值相等


From:http://tw.wingwit.com/Article/program/Oracle/201311/17479.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.