Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Connect problems with oracle

Connect problems with oracle

From: Praveen Mohan <praveenm_at_cisco.com>
Date: Mon, 27 Sep 1999 17:47:02 -0700
Message-ID: <Pine.GSO.4.10.9909271745530.1226-100000@danube.cisco.com>

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:



starbase:82> test3
connected to oracle

Oracle error

*MSG*ORA-01012: not logged on                  

CODE



main()
{
char username[12]= "tims1";
char password[12]= "tims1_test";
char db_string[12]="deveif8";

char tims_username[100];
void error();

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US