05-06-04, 02:57 #1Registered User
- Join Date
- Apr 2004
Unanswered: connecting to a remote oracle database using pro*c
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..
05-06-04, 15:35 #2Registered User
- Join Date
- Apr 2003
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
(PROTOCOL = TCP)
(Host = 999.999.999.999)
(Port = 9999)
(CONNECT_DATA = (SID = Prod)
(GLOBAL_NAME = Prod)