Message-Id: <25988.338881@fatcity.com> From: "Jamadagni, Rajendra" Date: Tue, 22 Jul 2003 09:22:14 -0400 Subject: RE: Using ALERT in a ProC program This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------=_NextPartTM-000-d14e89f0-38e2-4647-b306-251589d8f852 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C35054.43CA7775" ------_=_NextPart_001_01C35054.43CA7775 Content-Type: text/plain; charset="iso-8859-1" are you commiting after you send the alert? dbms_alert is transactional ... Raj ---------------------------------------------------------------------------- ---- Rajendra dot Jamadagni at nospamespn dot com All Views expressed in this email are strictly personal. QOTD: Any clod can have facts, having an opinion is an art ! -----Original Message----- From: Lendvary Gyurika [mailto:gyurika@prolan.hu] Sent: Tuesday, July 22, 2003 6:19 AM To: Multiple recipients of list ORACLE-L Subject: Using ALERT in a ProC program Hi, Thank you very much for your help, I can compile my program, but unfortulately it doesn't work. I'd like to use ALERT to notify my program about an event. Alert works, when I run two sql scripts in two sqlplus terminals. One of them is listening for an alert and the other one sends an alert. But now, my C program is listening for an alert, and I send an alert by my sql script. The C program doesn't get the alert. The other problem is, that dbms_output.putline doesn't work also. It writes nothing to the terminal. Here is a part of my program: static void fAlertRegister () { printf("\nAlert Register\n"); EXEC SQL EXECUTE BEGIN sys.dbms_alert.register( 'prolan_alert' ); END; END-EXEC; EXEC SQL COMMIT WORK; } static void fAlertWatch () { char buff[256]; printf("\nAlert Watch\n"); h_timer = 35 ; /* initial timeout in sec */ while ( 1 ) { EXEC SQL EXECUTE BEGIN sys.dbms_alert.waitany( :h_name, :h_message, :h_status, :h_timer); END; END-EXEC; h_name.arr[h_name.len]='\0'; h_message.arr[h_message.len]='\0'; h_timer = 35 ; /* sec the subsequent timeouts - default */ if ( h_status != 0 ) /* timeout */ { sprintf ( buff, "\nAlert (%d sec) Timed Out. / %d\n", (int)h_timer, (int)h_status ); printf(buff); continue ; } sprintf ( buff, "\nAlert <%s> Received :%s / %d\n", h_name.arr, h_message.arr, (int)h_status ); } } int main(int argc, char **argv) { EXEC SQL EXECUTE BEGIN SYS.DBMS_OUTPUT.PUT_LINE('It's a demo program'); END; END-EXEC; fAlertRegister (); fAlertWatch (); } Does anybody have an idea, what the solution is? Thanks a lot: Gyuri -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Lendvary Gyurika INET: gyurika@prolan.hu Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). ------_=_NextPart_001_01C35054.43CA7775 Content-Type: text/html; charset="iso-8859-1" RE: Using ALERT in a ProC program

<stupid_question>
are you commiting after you send the alert? dbms_alert is transactional ...

</stupid_question>

Raj
--------------------------------------------------------------------------------
Rajendra dot Jamadagni at nospamespn dot com
All Views expressed in this email are strictly personal.
QOTD: Any clod can have facts, having an opinion is an art !


-----Original Message-----
From: Lendvary Gyurika [mailto:gyurika@prolan.hu]
Sent: Tuesday, July 22, 2003 6:19 AM
To: Multiple recipients of list ORACLE-L
Subject: Using ALERT in a ProC program


Hi,

Thank you very much for your help, I can compile my program, but unfortulately
it doesn't work. I'd like to use ALERT to notify my program about an event.
Alert works, when I run two sql scripts in two sqlplus terminals. One of them is
listening for an alert and the other one sends an alert.
But now, my C program is listening for an alert, and I send an alert by my
sql script. The C program doesn't get the alert. The other problem is, that
dbms_output.putline doesn't work also. It writes nothing to the terminal. Here
is a part of my program:

static void fAlertRegister ()
{
  printf("\nAlert Register\n");
  EXEC SQL EXECUTE
    BEGIN
      sys.dbms_alert.register( 'prolan_alert' );
    END;
  END-EXEC;
  EXEC SQL COMMIT WORK;
}

static void fAlertWatch ()
{
 char buff[256];

  printf("\nAlert Watch\n");
  h_timer = 35 ; /* initial timeout in sec */
  while ( 1 )
  {
    EXEC SQL EXECUTE
      BEGIN
        sys.dbms_alert.waitany( :h_name, :h_message, :h_status, :h_timer);
      END;
    END-EXEC;

    h_name.arr[h_name.len]='\0';
    h_message.arr[h_message.len]='\0';
    h_timer = 35 ; /* sec the subsequent timeouts - default */
    if ( h_status != 0 ) /* timeout */
    {
      sprintf ( buff, "\nAlert (%d sec) Timed Out. / %d\n",
                (int)h_timer, (int)h_status );
      printf(buff);
      continue ;
    }
    sprintf ( buff, "\nAlert <%s> Received :%s / %d\n",
              h_name.arr, h_message.arr, (int)h_status );
  }
}

int main(int argc, char **argv)
{
  EXEC SQL EXECUTE
    BEGIN
      SYS.DBMS_OUTPUT.PUT_LINE('It's a demo program');
    END;
  END-EXEC;
 
  fAlertRegister ();
  fAlertWatch ();
}

Does anybody have an idea, what the solution is?

Thanks a lot:
   Gyuri
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Lendvary Gyurika
  INET: gyurika@prolan.hu

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

------_=_NextPart_001_01C35054.43CA7775-- ------=_NextPartTM-000-d14e89f0-38e2-4647-b306-251589d8f852 Content-Type: text/plain; name="ESPN_Disclaimer.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ESPN_Disclaimer.txt" ********************************************************************This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you.*********************************************************************2