Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How do I prevent "commit" when a program crashes???

Re: How do I prevent "commit" when a program crashes???

From: John Strange <jstrange_at_imtn.dsccc.com>
Date: 1997/04/23
Message-ID: <5jktlv$ioi@camelot.dsccc.com>#1/1

  	Here are come code snippets which We used to trap about 14
	signals which could create a core file, this is in a main
	program which spawns another program to do the oracle work.

In your case you need to trap other commands like HANGUP, SIGTERM, ..

try man signal

    man trap
look at /usr/include/signal.h or

        /usr/include/sys/signal.h

typedef void Sigfunc (int) ;
Sigfunc *signal (int, Sigfunc *) ;  

static void core_trap (int signo); /* notify toolsmiths of possible core creation */

int main (unsigned int argc, char *argv[]) {

<snip>

        /***********************************************************************
        *
        *       set signal traps to catch signals which can create 'core' files.
        *
        *       Also set SIGINT so we can ignore the user interrpting the program.
        *
        ***********************************************************************/
 
        signal (SIGINT, core_trap) ;    /* interrupt (^C, ^Y, rubout,... whatever)      */
        signal (SIGABRT, core_trap) ;   /* used by abort, replace SIGIOT in the future  */
        signal (SIGBUS, core_trap) ;    /* bus error                                    */


<snip>

} /* end main */

static void core_trap (int signo) /* notify toolsmiths of a possible core creation */

<snip>

        rtn = remove ("core") ;

	if (signo != SIGINT)		/* ignore the user interrupt	*/
	  ecm_crash (FATAL_ERR, app_name, err_msg, NULL, args, sub_ptr) ;

	_exit (signo) ;

} /* end core_trap */

Z. Martinez (zlm101_at_psu.edu) wrote:
: I have a Pro*C program that I am working on.  

: Currently, I commit after every 10,000 inserts. However, I noticed
: that when I break out of the program while in execution (using
: ctrl+C), the uncommitted records are committed to the database.
 

: How do I prevent this from happening???  

: I'm working on Oracle 7.3 under HPUX.  

: Thanks in advance.  

: Please respond to zlm101_at_psu.edu

--
This posting represents the personal opinions of the author. It is not the
official opinion or policy of the author's employer. Warranty expired when you
opened this article and I will not be responsible for its contents or use.
Received on Wed Apr 23 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US