Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Location
    St. Louis
    Posts
    1

    Unanswered: Segmentation fault while connecting to an Oracle Database

    I am having an issue connecting to a database within my Pro*C application.

    I am writing this in RedHat ES 2.1. With the Oracle 9i Database.

    From all the documentation on the web I feel my code is correct but For some reason when I isseue the EXEC SQL CONNECT command it loops through this command until it recieves the Segmentation Fault Message and then dies.

    Below is an expert of the code that I have written. It is the Connect Function.

    Any Help is greatly Appreciated.


    int connect()
    {
    EXEC SQL BEGIN DECLARE SECTION;
    VARCHAR dbname[128];
    VARCHAR strSQLStmt[255];
    VARCHAR username[128];
    VARCHAR password[32];
    int fileid;
    EXEC SQL END DECLARE SECTION;



    strncpy ((char *)username.arr, "monitor@peso_custom", UNAME_LEN);
    username.len = strlen((char *) username.arr);
    strncpy ((char *)password.arr, "monitor", PWD_LEN);
    password.len = strlen((char *) password.arr);
    printf("Have assigned all Username and password.\n");

    printf("\nGoing to connect to ORACLE as user %s at %s.\n", username.arr);

    EXEC SQL WHENEVER SQLERROR GOTO connect_error;

    EXEC SQL CONNECT :username IDENTIFIED BY :password;

    printf("\nConnected to ORACLE as user %s.\n", username.arr);


    connect_error:
    fprintf(stderr, "Failed to Connect to Oracle as %s : \n", username.arr);
    return (1);

    }

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

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