如题,能否使用Pipe向同机器的其他进程(基于MFC创建的应用程序)发送消息?我有做过尝试,但失败了,请高手指点一下,谢谢!最好给代码!

解决方案 »

  1.   

    学习,oracle 8i啊,不熟悉啊!比较熟悉的是oracle 10G
      

  2.   

    oracle里的pipe应该是自己内部的通信吧,异构系统不知道是不是自己要去解析管道的协议哟。这个用的比较少,不是很清楚叻。
      

  3.   

    Oracle中有没有类似SQL Server中通知服务的东西?现在需要写一个外部程序对Oracle中几个表实时监控修改,用轮询效率太低。请高手指教!谢谢!
      

  4.   

    对sql server不了解,这个通知的服务是怎样的一个服务,说具体一些。你这里对几个表做监控,具体是对什么的监控? 实时访问数据库不是一个好方法,能不能用应用来处理哟。
      

  5.   

    这个监控程序的主要用途就是当目标表被执行了记录增删改操作的时候,能够在最短的时间内捕获这些信息。虽然用触发器+轮询可以实现,但这个轮询周期不好控制,设短了资源浪费太大,设长了又无法满足时间要求。这是第一次用Oracle做数据源,不知道有什么好办法实现。
      

  6.   

    可以的.
    转一篇文章给你参考下,希望对你有用
    You   Asked   
        
      How   do   I   execute   an   executable     
      from   a   PL/SQL   code   (Without   using   the   
      SQL*Plus   "HOST"   command)?   
        
        
        
      --------------------------------------------------------------------------------   
      and   we   said...   
        
        
      In   Oracle7   --   you   cannot   execute   another   program   from   PLSQL.       
      You   can   'talk'   to   an   already   running   program   (which   in   turn   can     
      execute   another   process).     See     
      http://osi.oracle.com/~tkyte/plex/index.html   
      for   an   idea   on   how   this     
      works   --   we   can   use   dbms_pipe   to   send   messages   to   another     
      session   and   have   it   do   something   for   us.   
        
      In   Oracle8   --   this   feature   is   called   an   external   procedure   and     
      is   quite   easy   to   implement.     You   would   code   your   stored     
      procedure   in   C,   the   C   can   use   a   system()   command   for   example   to     
      run   another   process.   
        
      In   Oracle8i,   release   8.1   --   a   java   stored   procedure   can   run     
      external   processes   as   well   without   having   to   code   C.   
        
        
      In   unix,   you   can   do   something   like   this   as   well   (make   sure   you     
      understand   the   security   implications   here   --   run   host.csh   as   a     
      very   Non-priveleged   user!)   
        
      This   is   a   quick   and   dirty   daemon   --   written   in   csh   (the   cool     
      shell)..   
        
      Here   is   a   PL/SQL   subroutine   you   can   install   in   your   schema:   
        
      create   or   replace   procedure   host(   cmd   in   varchar2   )   
      as   
              status   number;   
      begin   
              dbms_pipe.pack_message(   cmd   );   
              status   :=   dbms_pipe.send_message(   'HOST_PIPE'   );   
              if   (   status   <>   0   )   then   raise_application_error(   -20001,     
      'Pipe   error'   );   
              end   if;   
      end;   
      /   
        
      Here   is   a   C-Shell   script   you   can   run   in   the   background   (use   this     
      shell   script   make   sure   it   is   named   host.csh)   
        
      --------------------   bof   ----------------------------   
      #!/bin/csh   -f   
          
      sqlplus   tkyte/tkyte   <<"EOF"   |   grep   '^#'   |   sed   's/^.//'   >   tmp.csh   
          
      set   serveroutput   on   
          
      declare   
                      status     number;   
                      command   varchar2(255);   
      begin   
                      status   :=   dbms_pipe.receive_message(   'HOST_PIPE'   );   
                      if   (   status   <>   0   )   then   
                                      dbms_output.put_line(   '#exit'   );   
                      else   
                                      dbms_pipe.unpack_message(   command   );   
                                      dbms_output.put_line(   '##!/bin/csh   -f'   );   
                                      dbms_output.put_line(   '#'   ||   command   );   
                                      dbms_output.put_line(   '#exec   host.csh'   );   
                      end   if;   
      end;   
      /   
      spool   off   
      "EOF"   
          
      chmod   +x   tmp.csh   
      exec   tmp.csh   
      -----------------------   EOF   ---------------------------------   
        
        
      If   you   run   this   in   the   background   (The   script),   you'll   be   able     
      to   have   it   
      execute   any   host   command   you   want.     Run   this   in   one   window   for     
      example   and   in   
      anther   window   go   into   sql*plus   and   try:   
        
      SQL>   exec   host(   'ls   -l'   );   
      SQL>   exec   host(   'uptime'   );   
      SQL>   exec   host(   'echo   Hello   World'   );   
      SQL>   exec   host(   'exit'   );   
        
      You'll   see   the   output   of   ls   -l,   uptime,   and   echo   happen   on   the     
      other   window   
      where   the   shell   script   is   running   (shows   you   a   way   to   debug     
      pl/sql   routines,   use   
      "host(   echo   some   string   )"   and   you'll   get   real   time   feedback     
      from   your   pl/sql   
      procedure).....