Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: oracle db connection problem
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
![]() |
![]() |