Pro*C Problem

From: Jennifer <jblankenship_at_osc.uscg.mil>
Date: 13 Sep 2001 09:21:27 -0700
Message-ID: <bd4da684.0109130821.69c2e249_at_posting.google.com>



[Quoted] [Quoted] I have an open TAR with Oracle about this. However, the TAR is 9 days old and they have not been able to help me resolve this. I am very frustrated right now.

[Quoted] The servers that are currently in production are running Oracle 7.3.4 in an HPUX 10.20 environment. We have bought new servers and have Oracle 8.1.6 installed on them in an HPUX 11.0 environment - 64 bit. So, we are recompiling all of the old code to run on the new servers. All of my code has compiled without errors, however, it does not run correctly.

[Quoted] The code is a text-based menu. Users login to the Unix box via a telnet session and make their selection from the menu. All of the menu routines are select statements - no updating or deleting data from the database. However, I can not get the menu to connect to the database. It just hangs. No error message at all.

[Quoted] I have combed MetaLink and Google trying all relevant suggestions I could find.

    [Quoted]
  • The $ORACLE_SID is lower case in all places: .profile, oratab, control files, initSID.ora, tnsnames.ora, listener.ora,
  • The $ORACLE_HOME is set correctly and is the absolute path.
  • Permissions for Oracle executable are 6755 and for tnslsnr are 4755.
  • Umask is set to 022 for all database users.
  • The file system is not mounted with no set uid.
  • I can connect to the database via SQL*Plus with no problems.
  • I can issue a tnsping and receive data back.

[Quoted] I can compile the Pro*C sample programs and they work just fine. I have actually copied the code from sample1.pc and pasted it into my code, in hopes of it working. No such luck. Since the code is identical, I would think it would have to be something outside of the code - the Makefile, for instance. The Oracle tech on my TAR doesn't think so. However, the Oracle sample code is compiled with the demo_proc.mk file. My code is compiled with a modified version of the Oracle Makefile.

[Quoted] Is there anything that anyone can think of that maybe was deleted from the modified Makefile that needs to be added back in? Or is there something else all together that is missing? I am pulling my hair out! Any help is appreciated!

[Quoted] Below is the function that is connecting to the database. I have hardcoded in the username and password, thinking maybe my call to the file for that information was having a problem - but that wasn't it. It prints out the printf statement that comes before the EXEC SQL CONNECT statement, but not the one following it. I assume that it is hanging on the EXEC SQL CONNECT statement.

[Quoted] #define SQLCA_STORAGE_CLASS extern

/* Define constants for VARCHAR lengths. */

[Quoted] #define     UNAME_LEN      20
#define     PWD_LEN        40

[Quoted] /* Declare variables. No declare section is

   needed if MODE=ORACLE. */
VARCHAR username[UNAME_LEN]; /* VARCHAR is an Oracle-supplied struct */
varchar password[PWD_LEN]; /* varchar can be in lower case also. */

/* Include the SQL Communications Area.

[Quoted]    You can use #include or EXEC SQL INCLUDE. */ #include <sqlca.h>

/****************************************************************************/

[Quoted] /* Function: oraconnect(connectfile)
*/
/* Purpose: Connects to ORACLE RDBMS using the Username and
Password */
/* specified in the connectfile. Each AMVER process has
its own */
/* connectfile containing an oracle user id and password.
The */
/* proc_code is the IEW process number. The subproc_code
can */
/* be used by the calling module to indicate the function
from */
/* where this function was called for traceback.
*/ /****************************************************************************/ /****************************************************************************/

[Quoted] short oraconnect(connectfile,proc_code, subproc_code)

[Quoted] char connectfile[80];

short proc_code;       /* Process identification codes */
short subproc_code;    /* from IEW document            */
{

    char temp_char[32];

/* Connect to ORACLE--

    [Quoted]
  • Copy the username into the VARCHAR. */ strncpy((char *) username.arr, "OUR_USERNAME", UNAME_LEN);

[Quoted] /* Set the length component of the VARCHAR. */

    username.len =
      (unsigned short) strlen((char *) username.arr);

/* Copy the password. */

[Quoted]     strncpy((char *) password.arr, "XXXXXXX", PWD_LEN);     password.len =
      (unsigned short) strlen((char *) password.arr);
/* Register sql_error() as the error handler. */

    EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--\n");

[Quoted]     printf("\nGetting ready to connect to ORACLE as user: %s\n", username.arr);

[Quoted] /* Connect to ORACLE. Program will call sql_error()

  • if an error occurs when connecting to the default database. */ EXEC SQL CONNECT :username IDENTIFIED BY :password;

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

   return(SUCCEED);

   logonerr:
[Quoted]      return(sqlerr(proc_code,subproc_code,11)); }

Thank you in advance for any help or insight that you may be able to provide. I have all ready wasted too much valuable time on this issue - at least, more than was allotted on the Project Plan. :-)

Jennifer Blankenship
[Quoted] jblankenship_at_osc(add dot)uscg(add dot)mil Received on Thu Sep 13 2001 - 18:21:27 CEST

Original text of this message