Home » Developer & Programmer » Precompilers, OCI & OCCI » How to connect to two databases ? (Pro*c / SunOS 5.8 / Oracle 9i)
How to connect to two databases ? [message #419728] Tue, 25 August 2009 06:15 Go to next message
l_majid
Messages: 8
Registered: August 2009
Location: Paris
Junior Member
Hello,

My program needs to connect to two databases and make operations in both databases:

Quote:
connect to db1;
connect to db2;

select from table in db1;
update table in db2;


i would like to know whether it's possible, and how to do it ? how to specify for each query the database connection to use?

please note that I can't use dblinks as i don't have enough access rights and privileges on neither of the databases.

thanks you for your replies.
Re: How to connect to two databases ? [message #419736 is a reply to message #419728] Tue, 25 August 2009 06:59 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes it is possible, read:
Pro*C/C++ Programmer's Guide
Chapter 3 Database Concepts
Section Advanced Connection Options

Regards
Michel
Re: How to connect to two databases ? [message #419737 is a reply to message #419736] Tue, 25 August 2009 07:11 Go to previous message
l_majid
Messages: 8
Registered: August 2009
Location: Paris
Junior Member
thank you very much that worked Smile


Quote:
EXEC SQL DECLARE XXXXX_DB DATABASE;

EXEC SQL CONNECT :user_id IDENTIFIED BY :password AT XXXXX_DB USING :db;

EXEC SQL AT XXXX_DB SELECT ......;

EXEC SQL AT XXXX_DB COMMIT;



vive le 92
Previous Topic: Need Help - Proc Error - 1540-0040 (S) The text "&" is unexpected.
Next Topic: Libgen Library not found
Goto Forum:
  


Current Time: Thu Mar 28 08:54:49 CDT 2024