Re: how to do multi-connect to DB in C program???

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/10/25
Message-ID: <3270bc05.43416109_at_dcsun4>#1/1


On 25 Oct 1996 23:03:38 GMT, tungn_at_dfwmm.net wrote:

>
>hi everybody,
>
>I try write a C program that have multi-connect to oracle database
>with same userid/passwd.
>my question is :
>
>1. How do I know which connection to use since oracle have not
> return any connection handle or ID.
>
>2. How to disconnect certain connection not all.
>
>thank you for any help
>

See chapt 3 of the pro*c manual. shows how to use multiple connection in a program. in a nutshell, you'll

EXEC SQL CONNECT :username IDENTIFIED BY :password AT :db_name1; EXEC SQL CONNECT :username IDENTIFIED BY :password AT :db_name2;

EXEC SQL AT :db_name1 UPDATE T1 SET X = 5; EXEC SQL AT :db_name2 UPDATE T2 SET Y = 10;

EXEC SQL AT :db_name1 COMMIT;
EXEC SQL AT :db_name2 COMMIT WORK RELEASE; .....

The two connects use the same user/pass but different db_names (not USING sql*net connect string syntax but AT). This gives you two connections. You then direct EXEC SQL statements using the AT :hostname syntax.....

In the aboe, the second commit also disconnect db_name2 but not db_name1....

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com

  • Check out Oracle Governments web site! ----- Follow the link to "Tech Center" and then downloadable Utilities for some free software...

statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Fri Oct 25 1996 - 00:00:00 CEST

Original text of this message