How to specify the "AT DB_NAME" in Connect Remote Database in Por*C

From: Roger Liu <rliu2_at_ford.com>
Date: Wed, 01 Dec 1999 11:23:09 -0500
Message-ID: <38454B6D.8ED81C6D_at_ford.com>



Hi,

[Quoted] Some background: One of my friend projects needs to connect to multiple Oracle Database in Pro*C: query one database and insert/update another.

Oracle Doc's indicates use "AT DB_NAME USING ..." or "AT :db_name USING
..." in connection. But I did not make it work. The following is the
code fragments modified for sample1.pc

1:
 ...
 char *mydb_string = "my_tnsname";

EXEC SQL DECLARE DB_NAME DATABASE;
 ...
/* In main() */
...

EXEC SQL CONNECT :username

       IDENTIFIED BY :password
                  AT DB_NAME
              USING  :mydb_string;

...

2:
...

char *mydb = "my_oraccle_sid";
char *mydb_string = "my_tnsname";

 ...
/* In main() */
...

EXEC SQL CONNECT :username

       IDENTIFIED BY :password
                             AT :mydb
                      USING  :mydb_string;


But I got the same error:

$ sample1

Connected to ORACLE as user: SCOTT/TIGER

Enter employee number (0 to quit): 7788

ORACLE error--

ORA-01012: not logged on

If removed the AT ... line, sampel1 worked fine to connect the remote database.

Q: What "String" or "Identifier" I should give after "AT" to make the

remote connection?

My Env:

Oracle: 8.05/7.3
Sun Solaris 2.6/AIX 4.1

Thanks

Roger Liu Received on Wed Dec 01 1999 - 17:23:09 CET

Original text of this message