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

Re: oracle db connection problem

From: Roland Schaar <rschaar_at_gosch.com>
Date: Fri, 17 Sep 1999 08:56:05 +0100
Message-ID: <37E1F415.8B95D219@gosch.com>


Are you using SQL-Net V2.3 Or Net80?
Did you check or TNSNAMES file (both orant\network\admin and orant\net80\admin)?

roland schaar
gosch consulting gmbh

Praveen Mohan wrote:

> 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 Fri Sep 17 1999 - 02:56:05 CDT

Original text of this message

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