Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Unable to connect to the database using Pro*C/C++
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.comReceived on Thu Jan 06 2005 - 04:38:33 CST
![]() |
![]() |