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 -> oracle db connection problem

oracle db connection problem

From: Praveen Mohan <praveenm_at_cisco.com>
Date: Thu, 16 Sep 1999 16:45:58 -0700
Message-ID: <Pine.GSO.4.10.9909161640540.8133-100000@danube.cisco.com>

Hi,

I have written a simple C script with embedded sql to connect to a database server. There is no compilation errors/warnings after using the Pro C/C++ precompiler and the corresponding make file. I get the error :
ORA-12505: TNS:listener could not resolve SID given in connect descriptor

Could anyone help please ?? I have attached the code below. The version no is 8.0.5

Thanks,

Praveen

#include <stdio.h>
#include <string.h>
#include <sqlca.h>

main()
{

char username[10]= "dev1";
char password[10]= "dev1_TEST";
char db_string[10]="deveif8";

void error();

EXEC SQL WHENEVER SQLERROR DO error("Oracle error \n"); EXEC SQL DECLARE DB_NAME DATABASE; printf("first line \n");
EXEC SQL CONNECT :username IDENTIFIED BY :password AT DB_NAME USING :db_string;
printf("connected to oracle \n");

}

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("%.*s\n", msg_len, err_msg);     exit(1);
} Received on Thu Sep 16 1999 - 18:45:58 CDT

Original text of this message

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