Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Location
    arlington,tx
    Posts
    12

    Unanswered: connecting to a remote oracle database using pro*c

    Hi guys,
    I am having trouble with connecting to a remote oracle database using pro*c.
    Currently my linux machine(say A) has pro*c installed and oracle installed. so im connecting with a string that looks something like this

    exec sql connect :username IDENTIFIED BY assword;

    Now i have to shift my code to other linux system(say B). It has pro*C and oracle installed.
    BUT i dont want to use the oracle that is installed in this (B)system, but i want to use
    the oracle installed in the other system(A). i guess i need to use a remote database connection string,

    In the internet i found some connection string like,

    EXEC SQL CONNECT :userid IDENTIFIED BY assword at :db_name using :db_string;

    can you please tell me whether this would work and if yes tell me what the 'at' parameter and 'using' parameter is for ?

    I am wondering where we have to give the machine name, database name, protocol to use to connect , port etc..etc..

  2. #2
    Join Date
    Apr 2003
    Location
    NY
    Posts
    208
    As long as the entry is in your tnsnames.ora you should be able to use

    exec sql CONNECT :username IDENTIFIED BY assword USING :sid_name;

    USING tells the oracle client what entry from the tnsnames you would like to connect to.

    The tnsnames entry tells Oracle the necessary server, port, and protocol.
    -- Take from tnsnames.ora
    Prod =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS =
    (PROTOCOL = TCP)
    (Host = 999.999.999.999)
    (Port = 9999)
    )
    )
    (CONNECT_DATA = (SID = Prod)
    (GLOBAL_NAME = Prod)
    )
    )

    HIH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •