Pro*C App Using Sqlglm Function Crashes After Upgrade (Doc ID 1261314.1)

Last updated on MAY 15, 2013

Applies to:

Precompilers - Version 9.2.0.8 and later
Information in this document applies to any platform.
***Checked for relevance on 15-May-2013***

Symptoms


You have a Pro*C applications that use the sqlglm() interface and it now coredumps/segmentation faults after upgrade. The upgrade can be from any release to any newer release but ultimately, the previous release was 32bit and the new release is 64bit.

Below is a sample application that intentionally mispells the dual table so that an error is returned and the sqlglm function is called and crashes in sqlglmt:

The following code is stored in a file named sqlglmtest.pc:

#include <stdio.h>
#include <string.h>
#include <sqlca.h>
typedef struct oradata
   {
   char acErrorMsg[2000];
   long lReturnCode;
   } _ora00003_ORADATA_T;

_ora00003_ORADATA_T m_zOracle;

EXEC SQL BEGIN DECLARE SECTION;
VARCHAR myID[30];
VARCHAR mypasswd[30];
VARCHAR passid[30];
EXEC SQL END DECLARE SECTION;

void sql_error();

int main (int argc, char *argv[] )
{
   char a[1];
   strcpy(myID.arr,"SCOTT");
   myID.len=strlen(myID.arr);
   strcpy(mypasswd.arr,"TIGER");
   mypasswd.len=strlen(mypasswd.arr);
   strcpy(passid.arr,"");
   passid.len=strlen(passid.arr);

   EXEC SQL WHENEVER SQLERROR DO sql_error();

   EXEC SQL CONNECT :myID IDENTIFIED BY :mypasswd USING :passid;

   EXEC SQL WHENEVER NOT FOUND DO sql_error();

   EXEC SQL SELECT DUMMY INTO :a from DAUAL ;

   printf("Value is %c",a);
   return 0;
}

void sql_error()
{
   unsigned int iBufferLen;
   unsigned int iMessageLen;
   iBufferLen = 2000;
   EXEC SQL WHENEVER SQLERROR CONTINUE;

   sqlglm(m_zOracle.acErrorMsg, &iBufferLen, &iMessageLen);
   m_zOracle.acErrorMsg[iMessageLen] = '\0';
   m_zOracle.lReturnCode = sqlca.sqlcode;
   printf("%d %s\n",iMessageLen,m_zOracle.acErrorMsg);
   EXEC SQL ROLLBACK RELEASE;
   exit(1);
}

 

Changes

32bit client now built with 64bit client

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms