Home » Developer & Programmer » Precompilers, OCI & OCCI » in pro*c
in pro*c [message #178874] Fri, 23 June 2006 04:31 Go to next message
raom
Messages: 22
Registered: January 2006
Location: india
Junior Member
how can u specify the database to login in pro*c

i have to databases on same machine with same username password but different SID .also they have same tables with minor changes

now
how can u specify the database to which to connect using SID in pro*c.

i did

export ORACLE_SID = xxxx but in vain.please suggest.

[Updated on: Fri, 23 June 2006 04:32]

Report message to a moderator

Re: in pro*c [message #178898 is a reply to message #178874] Fri, 23 June 2006 05:59 Go to previous messageGo to next message
Frank Naude
Messages: 4571
Registered: April 1998
Senior Member
Example from the Pro*C/C++ Programmer's Guide:

/* declare needed host variables */
char  username[10]  = "scott"; 
char  password[10]  = "tiger";
char  db_string[20] = "NYNON"; 

/* give the database connection a unique name */ 
EXEC SQL DECLARE DB_NAME DATABASE; 

/* connect to the nondefault database  */
EXEC SQL CONNECT :username IDENTIFIED BY :password 
   AT DB_NAME USING :db_string;
Re: in pro*c [message #178902 is a reply to message #178898] Fri, 23 June 2006 06:15 Go to previous message
raom
Messages: 22
Registered: January 2006
Location: india
Junior Member
thanks for the reply
i donno if i understand that.let me elaborate

i have a user guna/guna with SID PQR
one more user guna/guna with SID KML

where KML is default but i dont want to connect to default one.

what can i do.
Previous Topic: Problems with OCI without an environment (ORACLE_HOME not set)
Next Topic: Oracle XA support and how to run the scripts?
Goto Forum:
  


Current Time: Fri Jul 01 01:52:49 CDT 2022