Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004
    Posts
    2

    Unanswered: Please help.....Connection Error

    I have a Pro*C application being developed on Linux.
    I have 2 functions, one which connects to the oracle database and the second function to update a table.
    The first function connection()works fine (sucessfully connects to the DB).But when i try to update the table, i get the error message "ORA-01012: not logged on"

    What is the problem?Is the session killed?
    Please help.

    Thanks
    Naresh

  2. #2
    Join Date
    Apr 2004
    Posts
    246
    are the 2 functions within the same Pro*C executable?

    are you sure the connect function works? does it check the sqlca for errors?
    Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.

  3. #3
    Join Date
    Sep 2004
    Posts
    2
    Hi,


    Here is my program.It does connect properly to the oracleDB,but fials with the error "ORA-01012 user not logged in" when i call the UpdateFile();
    What exactly would be the reason?

    Thanks


    void main(argc,argv)
    {
    Oracle_Connect();
    UpdateFile();
    if(gConnect_Successful == 'T')
    Oracle_Disconnect();
    exit(0);
    }

    Oracle_Connect()
    {
    printf("In Oracle_Connect\n");
    strcpy((char *)hConnect_String.arr, CONNECT_STRING);
    setlen(hConnect_String);
    setnull(hConnect_String);

    EXEC SQL CONNECT :hConnect_String;

    if (sqlca.sqlcode != SUCCESS)
    {
    printf("Unable to Connect to Oracle\n");
    gConnect_Successful = 'F';
    }
    }

    UpdateFile()
    {
    printf("In Update Failed\n");
    EXEC SQL INSERT INTO admin.userdetails@bill
    (username,
    service_id,
    account_id1)
    VALUES ('QQQQ',
    'GSMNew',
    '111111');
    if(sqlca.sqlcode != SUCCESS)
    printf("sqlca.sqlcode : %d\t Record not inserted into userdetails@bill\n",
    sqlca.sqlcode);
    else
    printf("Record inserted successfully into userdetails@bill\n");


    }

    Oracle_Disconnect()
    {
    EXEC SQL COMMIT WORK RELEASE;
    if (sqlca.sqlcode != SUCCESS)
    printf("Unable to Disconnect\n");
    return(0);
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •