Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Connect problems with oracle
Hi folks,
Ihave a problem running a simple Pro C script.The connection info is
correct.
If I change any of the username,password or
db_string fields , I get an invalid loginid/password message.
I don't understand where I can drop the connection as the select statement
immediately follows the connect statement.The code and the output is
below.Any help is appreciated.
Thanks,
Praveen
praveenm_at_cisco.com
OUTPUT:
Oracle error
*MSG*ORA-01012: not logged on
CODE
char username[12]= "tims1"; char password[12]= "tims1_test"; char db_string[12]="deveif8";
EXEC SQL WHENEVER SQLERROR DO error("Oracle error \n");
EXEC SQL DECLARE DB_NAME DATABASE;
EXEC SQL CONNECT :username IDENTIFIED BY :password AT DB_NAME USING
:db_string;
printf("connected to oracle \n");
EXEC SQL SELECT username
INTO :tims_username
FROM tms_groups
WHERE tms_groups.grp_id =802;
printf("username is %s \n",tims_username); }
void error(msg)
char *msg;
{
char err_msg[128];
int buf_len, msg_len;
EXEC SQL WHENEVER SQLERROR CONTINUE; printf("\n%s\n", msg);
buf_len = sizeof (err_msg);
sqlglm(err_msg, &buf_len, &msg_len);
printf("*MSG*%.*s\n", msg_len, err_msg);
exit(1);
}
Received on Mon Sep 27 1999 - 19:47:02 CDT
![]() |
![]() |