1

I am practicing with a Pro*C program and SQL and I have the following simple program:

#include <stdio.h>
#include <sqlca.h>

char user_id[20]="test/test"
char emp_name[20];

main()
{
    EXEC SQL CONNECT :userid;
    printf("Connected\n");

    EXEC SQL DECLARE emp_cursor CURSOR FOR
        SELECT name
        FROM badge;

    EXEC SQL OPEN emp_cursor;

    printf("Employees---------------");
    EXEC SQL WHENEVER NOT FOUND DO break;while (1)
       {
          EXEC SQL FETCH emp_cursor INTO :emp_name;
          printf("%s\n", emp_name);
        }

    EXEC SQL CLOSE emp_cursor;
    EXEC SQL COMMIT WORK RELEASE;

    exit(0);
}

It simply retrieves all the names from a table called BADGE:

CREATE TABLE BADGE  
(
    badge_id NUMBER PRIMARY KEY,
    name VARCHAR(20),   
    surname VARCHAR(20) NOT NULL,   
    birthday DATE
);

However, when I try to compile the source I have the following error:

proc test.pc proc: symbol lookup error: proc: undefined symbol: kgsuglo_

Can anyone help me out with the error?

Community
  • 1
  • 1
  • Which version of Oracle/Pro*C? Instant client or full install? Is your environment set up properly - PATH and LD_LIBRARY_PATH set and exported? – Alex Poole Jun 13 '16 at 11:06
  • PATH and LD_LIBRARY_PATH are correctly exported. Is there a way I can use to check the version of Oracle/Pro*C and the type of the installation? I am using an already existing test environment – user3610096 Jun 13 '16 at 11:15
  • Does `proc` display the banner, which includes the version and system default path - or is it failing before it even gets that far? If not what does the`sqlplus` banner show? Failing that your ORACLE_HOME might tell you, along with the entry for that in your PATH (whether it has ORACLE_HOME/bin). – Alex Poole Jun 13 '16 at 11:20
  • `proc` fails before displaying the banner, while `sqlplus` correctly works – user3610096 Jun 13 '16 at 11:24
  • OK, but what version info does SQL\*Plus show? Not sure how you get Pro*C to fail that early though, without any further info shown. – Alex Poole Jun 13 '16 at 11:26
  • Use ldd to inspect loaded depencies (*.so). You might be loading the wrong versions or the loader might not be able to locate alll dependencies. – user2672165 Jun 13 '16 at 11:53
  • The `sqlplus` version is 11.2.0.4.0 – user3610096 Jun 13 '16 at 12:18

1 Answers1

1

I had this problem with instantclient-precomp-linux.x64-12.1.0.1.0.zip and solved it by upgrading to instantclient-precomp-linux.x64-12.1.0.2.0.zip

MIRMIX
  • 1,052
  • 2
  • 14
  • 40