ORA-3106 Error with Proc*C

From: Paul B. Feole <paul_feole_at_merck.com>
Date: 1998/01/12
Message-ID: <34BA84A1.E8F223AE_at_merck.com>#1/1


ORACLE: 7.1.3
[Quoted] OpenVMS AXP: 6.2

First of all, many thanks to everyone who answered my previous post regarding using Pro*C to insert long data. You might recognize some of your code in the attached function. Anyways, I've got the insert part of the program working, now the select function just doesn't want to work.

The parameters are passed in via an DCL comfile which then executes the C program. Everything works fine until I get the error message: "ORA-03106: fatal two-task communication protocol error" just after the printf statement which echoes the libkey data value. This error occurs when trying to select the long into a buffer.

Am I missing something ?

TIA,
Cliff Buetikofer
(clifford_buetikofer_at_merck.com)
[Quoted] (noodles_at_aol.com)

Below is the C Function which actually does the select

[---------------------------------------------------------]

/*---------------------------------*/
/*GET_FILE FUNCTION */
/*Takes output file name and */
/*creates the file. */
/*---------------------------------*/

int get_file(char file_name[])
{

EXEC SQL BEGIN DECLARE SECTION;
typedef struct rec_my_long
{
 long len;
 unsigned char arr[1];
} my_long;

EXEC SQL TYPE my_long IS LONG VARCHAR(1000) REFERENCE;

my_long * sbuffer;
int i;
int size;
FILE * output;

EXEC SQL END DECLARE SECTION;  EXEC SQL WHENEVER SQLERROR GOTO error;
 EXEC SQL WHENEVER NOT FOUND GOTO not_found;

 printf("Selecting scheme data for libkey: %s\n",libkey.arr);

/*WORKS UP TO HERE */
 EXEC SQL SELECT RXN_SCHEME INTO :sbuffer   FROM LIBRARY_RXN_SCHEMES
  WHERE LIBKEY = :libkey;

 printf("Got through buffer select...\n");

 if ((output = fopen(file_name,"w")) == NULL)  {
  goto error;
 }
 printf("file_name pointer value: %s\n",output);

 sbuffer->len = sizeof sbuffer->arr;
 printf("Buffer Size: %ld\n",sbuffer->len);

 fwrite(sbuffer->arr, 1, sbuffer->len, output);  printf("Writing string buffer to file\n");

 fclose(output);

 memset ( sbuffer->arr, 0, size);

 return (PASS);

 not_found:
 error:
  error_index++;

  strcpy(error_msg[error_index].text, sqlca.sqlerrm.sqlerrmc);
  strcat(error_msg[error_index].text," File Write Failed");
  strcat(error_msg[error_index].text,"   -   libkey.arr: ");
  strcat(error_msg[error_index].text,libkey.arr);

  if ((output = fopen(file_name,"r")) == NULL)     strcat(error_msg[error_index].text," - File WRITE Failed");

  printf("%s\n", error_msg[error_index].text);

  return (FAIL);

}

       The contents of this message express only the sender's opinion.
       This message does not necessarily reflect the policy or views of
       my employer, Merck & Co., Inc.  All responsibility for the statements
       made in this Usenet posting resides solely and completely with the
       sender.
Received on Mon Jan 12 1998 - 00:00:00 CET

Original text of this message