1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>Aborting a Transaction</title> 7 <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.62.4" /> 9 <link rel="home" href="index.html" title="Getting Started with Berkeley DB Transaction Processing" /> 10 <link rel="up" href="usingtxns.html" title="Chapter 3. Transaction Basics" /> 11 <link rel="previous" href="usingtxns.html" title="Chapter 3. Transaction Basics" /> 12 <link rel="next" href="autocommit.html" title="Auto Commit" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Aborting a Transaction</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="usingtxns.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 3. Transaction Basics</th> 23 <td width="20%" align="right"> <a accesskey="n" href="autocommit.html">Next</a></td> 24 </tr> 25 </table> 26 <hr /> 27 </div> 28 <div class="sect1" lang="en" xml:lang="en"> 29 <div class="titlepage"> 30 <div> 31 <div> 32 <h2 class="title" style="clear: both"><a id="abortresults"></a>Aborting a Transaction</h2> 33 </div> 34 </div> 35 <div></div> 36 </div> 37 <p> 38 When you abort a transaction, all database 39 <span> 40 or store 41 </span> 42 modifications performed 43 under the protection of the transaction are discarded, and all 44 locks currently held by the transaction are released. In this event, 45 your data is simply left in the 46 state that it was in before the transaction began performing data 47 modifications. 48 </p> 49 <p> 50 Note that aborting a transaction may result in disk 51 <span> 52 I/O if your logs are backed by the filesystem. 53 </span> 54 55 It is possible that during the course of your transaction, 56 logging data and/or database 57 <span>pages</span> 58 59 were written to backing files on disk. For this reason, DB 60 notes that the abort occurred in its log files so that at a 61 minimum the database can be brought into a consistent state at 62 recovery time. 63 </p> 64 <p> 65 Also, once you have aborted a transaction, the transaction 66 handle that you used for the transaction is no longer valid. To 67 perform database activities under the control of a new 68 transaction, you must obtain a fresh transactional handle. 69 </p> 70 <p> 71 To abort a transaction, call 72 73 74 <span><tt class="methodname">Transaction.abort()</tt>.</span> 75 76 77 </p> 78 </div> 79 <div class="navfooter"> 80 <hr /> 81 <table width="100%" summary="Navigation footer"> 82 <tr> 83 <td width="40%" align="left"><a accesskey="p" href="usingtxns.html">Prev</a> </td> 84 <td width="20%" align="center"> 85 <a accesskey="u" href="usingtxns.html">Up</a> 86 </td> 87 <td width="40%" align="right"> <a accesskey="n" href="autocommit.html">Next</a></td> 88 </tr> 89 <tr> 90 <td width="40%" align="left" valign="top">Chapter 3. Transaction Basics </td> 91 <td width="20%" align="center"> 92 <a accesskey="h" href="index.html">Home</a> 93 </td> 94 <td width="40%" align="right" valign="top"> Auto Commit</td> 95 </tr> 96 </table> 97 </div> 98 </body> 99</html> 100