[Oracle] Pro * c link to oracle Database

Source: Internet
Author: User

[Oracle] Pro * c link oracle database 1 program Link oracle database:

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

 

DbServer is the definition of no IP address found in the UCRC file. How do I connect to a remote database? ---------------------------------------------------- The storage path of the tnsnames. ora file is $ ORACLE_HOME/network/admin. The following is an example:
  OID.LOCALDOMAIN =  (DESCRIPTION =   (ADDRESS_LIST =   (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT =  1521))   )   (CONNECT_DATA =   (SERVICE_NAME = oid)   )  )  CAMS.LOCALDOMAIN =  (DESCRIPTION =   (ADDRESS_LIST =   (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT =  1521))   )   (CONNECT_DATA =   (SERVICE_NAME = cams)   )  )  INST1_HTTP.LOCALDOMAIN =  (DESCRIPTION =   (ADDRESS_LIST =   (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT =    1521))   )   (CONNECT_DATA =   (SERVER = SHARED)   (SERVICE_NAME = MODOSE)   (divSENTATION = http://admin)   )   )  EXTPROC_CONNECTION_DATA.LOCALDOMAIN =   (DESCRIPTION =   (ADDRESS_LIST =   (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))   )   (CONNECT_DATA =   (SID = PLSExtProc1)   (divSENTATION = RO)   )   )

 

The tnsnames. ora file defines one or more network services. The network service corresponding to the net service cams instance is
  CAMS.LOCALDOMAIN =  (DESCRIPTION =   (ADDRESS_LIST =   (ADDRESS =   (PROTOCOL = TCP)   (HOST = localhost.localdomain)   (PORT = 1521))   )   (CONNECT_DATA =   (SERVICE_NAME = cams)   )  )

 

Note that the ADDRESS item contains three sub-parameters: PROTOCOL: default protocol tcp host: ip address port: PORT. The default value is 1521 CAMS. LOCALDOMAIN is the data name. Make sure that there is a corresponding ADDRESS item in the listener file that also contains the same three sub-parameters and the sub-parameter values are equal. In addition, the value of SERVICE_NAME must be consistent the value of the SID_NAME parameter under the SID_DESC item in the listener file is equal.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.