Re: Hello Oracle World question...
Date: 1995/03/29
Message-ID: <tbrav.796492667_at_ctp.com>#1/1
You can use the exact same login string in Pro*C without doing anything special. For example,
EXEC SQL INCLUDE sqlca.h;
main (int argc, char **argv)
{
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR logon[61];
VARCHAR ename[21];
double sal;
EXEC SQL END DECLARE SECTION;
strcpy ( logon, "bkeefe/bkeefe_at_tns_server");
/* or get it from command line arguments */
EXEC SQL CONNECT :logon;
EXEC SQL DECLARE mycurs CURSOR FOR
SELECT ename, sal FROM EMP;
for (;;)
{
FETCH mycurs INTO :ename, :salary;
if (sqlca.sqlcode != 0)
break;
sal.arr[sal.len] = '\0';
printf ("%s = %d\n", ename.arr, sal);
}
EXEC SQL COMMIT WORK RELAEASE; }
The CONNECT command has 2 other parameters: IDENTIFIED BY is the password, and USING which is the SQL*Net string - you can use 'em or not.
Tony Bravo
tbrav_at_ctp.com
bkeefe_at_seas.gwu.edu (Brian J. Keefe) writes:
>I have to hack a small ProC program just to get some data.
>If I can login into sqlplus with the following statement:
>% sqlplus bkeefe/bkeefe_at_tns_server
>I am wondering what this will look like in ProC. If anyone can
>tell me by email or post, I will be grateful.
>Thanks,
>-- Brian Keefe
>bkeefe_at_seas.gwu.edu
-- __________________________________________________________________________ Tony Bravo <tbrav_at_ctp.com> Cambridge Technology Partners, Inc. 2361 Rosecrans Ave, El Segundo, CA 90245 Tel: 310-297-3804 FAX: 310-297-3900Received on Wed Mar 29 1995 - 00:00:00 CEST