Home » SQL & PL/SQL » SQL & PL/SQL » ORA-12560: TNS:protocol adapter error
ORA-12560: TNS:protocol adapter error [message #191405] Wed, 06 September 2006 03:31 Go to next message
nandkishore
Messages: 2
Registered: September 2006
Location: Hyderabad, India
Junior Member
Hi All ,

I have recently started working on Pro*C. I have been trying to compile the sample1.pc in ${ORACLE_HOME}/precomp/demo/proc/sample1/sample1.pc and create the sample1.exe file. Finally after a day of hard work I could build the sample1.exe but when I executed it I got the following error.

ORA-12560: TNS:protocol adapter error

I am working on a Windows XP machine and my database is hosted on a remote server.

I had modified the sample1.pc in the following way.

/* Connect to ORACLE--
 * Copy the username into the VARCHAR.
 */
    strncpy((char *) username.arr, "test123", UNAME_LEN);

/* Set the length component of the VARCHAR. */
    username.len = 
      (unsigned short) strlen((char *) username.arr);

/* Copy the password. */
    strncpy((char *) password.arr, "test123", PWD_LEN);
    password.len = 
      (unsigned short) strlen((char *) password.arr);

/* Copy the Database Name. */
    strncpy((char *) dbname.arr, "ORADB", DBNAME_LEN);
    dbname.len = 
      (unsigned short) strlen((char *) dbname.arr);

/* Register sql_error() as the error handler. */
    EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--\n");

/* Connect to ORACLE.  Program will call sql_error()
 * if an error occurs when connecting to the default database.
 */

    EXEC SQL DECLARE DB_NAME DATABASE ;
    EXEC SQL CONNECT :username IDENTIFIED BY :password AT :dbname;


This was the format suggested in one of the links thrown up Google.

Would appreciate your help to help me resolve the issue.

Thanks and Regards
Nand Kishore Sagi
Re: ORA-12560: TNS:protocol adapter error [message #191419 is a reply to message #191405] Wed, 06 September 2006 05:21 Go to previous messageGo to next message
amul
Messages: 252
Registered: April 2001
Location: Chennai
Senior Member
i think the problem is with the TNSNAMES.ora file.. pls correct me if i am wrong
Re: ORA-12560: TNS:protocol adapter error [message #191958 is a reply to message #191419] Sat, 09 September 2006 04:30 Go to previous message
nandkishore
Messages: 2
Registered: September 2006
Location: Hyderabad, India
Junior Member
Hi Amul ,

I have checked the TNSNAMES.ORA file. The setting is perfect. The DBNAME oradb actually refers to the alias and not the SERVICE_NAME. I tried to debug the sample1.exe using VC++ debugger and I found that it was running into calls of SQLLIB which I could not understand.

I believe I am missing something very trivial but unfortuantaely cannot find that out.

Your help would be greatly appreciated.

Thanks and Regards
Nand Kishore Sagi
Previous Topic: Urgent Help needed.....
Next Topic: Problem with Execute Immediate and Alter Table in PL/SQL
Goto Forum:
  


Current Time: Sun Dec 04 08:33:25 CST 2016

Total time taken to generate the page: 0.07647 seconds