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 -> Unable to connect to the database using Pro*C/C++

Unable to connect to the database using Pro*C/C++

From: Xavier Darcos via OracleMonster.com <forum_at_OracleMonster.com>
Date: Thu, 06 Jan 2005 10:38:33 GMT
Message-ID: <580e7eb39a114dd28c66c2bbf3280819@OracleMonster.com>


Hello,

I am trying to understand Pro*C/C++. Thus, I used the samples provided by Oracle 8i (and in particular cppdemo01 project).

I generated the .cpp from the .pc and build my project: cppdemo01.exe.

When executing it, I get "ORA-12560: TNS: protocol adapter error".

Extract of th .pc file:
username.len = (unsigned short)strlen(strcpy((char *)username.arr, "test")); password.len = (unsigned short)strlen(strcpy((char *)password.arr, "test")); dbname.len = (unsigned short)strlen(strcpy((char *)dbname.arr, "BDDEV1")); EXEC SQL CONNECT :username IDENTIFIED BY :password AT: dbname;

But the slqnet.log indicates:
"

 (DESCRIPTION=(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=oracleORCL)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))'))(CONNECT_DATA=(SID=ORCL)(CID=(PROGRAM=C:\oracle\ora81\precomp\demo\proc\cppdemo1\WinDebug\cppdemo1.exe)(HOST=AFR108339)(USER=E257144))))
"

which is not the database I am trying to connect to so it seems normal that it doesn't work. But why the exe doesn't try to access to BDDEV1 passed as a parameter of EXEC SQL CONNECT ?

Note that I am able to connect to the database through SQL*Plus, Toad and the TNSPing works well.
"

C:>tnsping BDDEV1

Attempting to contact (ADDRESS=(PROTOCOL=TCP)(HOST=BD8TS)(PORT=1526)) OK (50 msec)
"

OS: Windows 2000.
Softs: Oracle 8i Client, Microsoft Visual C++ 6.0

Any idea would be welcome. Thanks in advance. Xavier

-- 
Message posted via http://www.oraclemonster.com
Received on Thu Jan 06 2005 - 04:38:33 CST

Original text of this message

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