ibm-information-center/dist/eclipse/plugins/i5OS.ic.cli_5.4.0.1/rzadpfnendtr.htm

161 lines
9.8 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="SQLEndTran - Commit or roll back a transaction" />
<meta name="DC.Relation" scheme="URI" content="rzadphdapi.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rzadpfnendtr" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>SQLEndTran - Commit or roll back a transaction</title>
</head>
<body id="rzadpfnendtr"><a name="rzadpfnendtr"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">SQLEndTran - Commit or roll back a transaction</h1>
<div><div class="section"></div>
<div class="section"><h4 class="sectiontitle">Purpose</h4> <p><samp class="codeph">SQLEndTran()</samp> commits
or rolls back the current transaction in the connection.</p>
<p>All changes
to the database performed on the connection since connect time or the previous
call to <samp class="codeph">SQLEndTran()</samp> (whichever is the most recent) are committed
or rolled back.</p>
<p>If a transaction is active on a connection, the application
must call <samp class="codeph">SQLEndTran()</samp> before it can disconnect from the
database.</p>
</div>
<div class="section"><h4 class="sectiontitle">Syntax</h4><pre>SQLRETURN SQLEndTran (SQLSMALLINT hType,
SQLINTEGER handle,
SQLSMALLINT fType);</pre>
</div>
<div class="section"><h4 class="sectiontitle">Function arguments</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="all"><caption>Table 1. SQLEndTran arguments</caption><thead align="left"><tr><th align="left" valign="bottom" width="19.888475836431226%" id="d0e56">Data type</th>
<th align="left" valign="bottom" width="19.888475836431226%" id="d0e58">Argument</th>
<th align="left" valign="bottom" width="13.940520446096654%" id="d0e60">Use</th>
<th align="left" valign="bottom" width="46.28252788104089%" id="d0e62">Description</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" width="19.888475836431226%" headers="d0e56 ">SQLINTEGER</td>
<td align="left" valign="top" width="19.888475836431226%" headers="d0e58 "><em>handle</em></td>
<td align="left" valign="top" width="13.940520446096654%" headers="d0e60 ">Input</td>
<td align="left" valign="top" width="46.28252788104089%" headers="d0e62 ">Handle to use when performing the COMMIT
or ROLLBACK.</td>
</tr>
<tr><td align="left" valign="top" width="19.888475836431226%" headers="d0e56 ">SQLSMALLINT</td>
<td align="left" valign="top" width="19.888475836431226%" headers="d0e58 "><em>fType</em></td>
<td align="left" valign="top" width="13.940520446096654%" headers="d0e60 ">Input</td>
<td align="left" valign="top" width="46.28252788104089%" headers="d0e62 ">Wanted action for the transaction. The value
for this argument must be one of: <ul><li>SQL_COMMIT</li>
<li>SQL_ROLLBACK</li>
<li>SQL_COMMIT_HOLD</li>
<li>SQL_ROLLBACK_HOLD</li>
<li>SQL_SAVEPOINT_NAME_ROLLBACK</li>
<li>SQL_SAVEPOINT_NAME_RELEASE</li>
</ul>
</td>
</tr>
<tr><td align="left" valign="top" width="19.888475836431226%" headers="d0e56 ">SQLSMALLINT</td>
<td align="left" valign="top" width="19.888475836431226%" headers="d0e58 "><em>hType</em></td>
<td align="left" valign="top" width="13.940520446096654%" headers="d0e60 ">Input</td>
<td align="left" valign="top" width="46.28252788104089%" headers="d0e62 ">Type of handle It must contain SQL_HANDLE_ENV
or SQL_HANDLE_DBC.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Usage</h4><div class="p">Completing a transaction with SQL_COMMIT or
SQL_ROLLBACK has the following effects: <ul><li> Statement handles are still valid after a call to <samp class="codeph">SQLEndTran()</samp>.</li>
<li>Cursor names, bound parameters, and column bindings survive transactions.</li>
<li>Open cursors are closed, and any result sets that are pending retrieval
are discarded.</li>
</ul>
</div>
<p>Completing the transaction with SQL_COMMIT_HOLD or SQL_ROLLBACK_HOLD
still commits or rolls back the database changes, but does not cause cursors
to be closed.</p>
<p>If no transaction is currently active on the connection,
calling <samp class="codeph">SQLEndTran()</samp> has no effect on the database server
and returns SQL_SUCCESS.</p>
<p><samp class="codeph">SQLEndTran()</samp> might fail while
executing the COMMIT or ROLLBACK due to a loss of connection. In this case
the application might be unable to determine whether the COMMIT or ROLLBACK
has been processed, and a database administrator's help might be required.
Refer to the Database Management System (DBMS) product information for more
information about transaction logs and other transaction management tasks.</p>
<p>When
using either SQL_SAVEPOINT_NAME_ROLLBACK or SQL_SAVEPOINT_NAME_RELEASE, you
must already have set the savepoint name using <samp class="codeph">SQLSetConnectAttr</samp>.</p>
</div>
<div class="section"><h4 class="sectiontitle">Return codes</h4><ul><li>SQL_SUCCESS</li>
<li>SQL_ERROR</li>
<li>SQL_INVALID_HANDLE</li>
</ul>
</div>
<div class="section"><h4 class="sectiontitle">Diagnostics</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="rows"><caption>Table 2. SQLEndTran SQLSTATEs</caption><thead align="left"><tr><th align="left" valign="top" width="22.86245353159851%" id="d0e164">SQLSTATE</th>
<th align="left" valign="top" width="23.605947955390334%" id="d0e166">Description</th>
<th align="left" valign="top" width="53.53159851301115%" id="d0e168">Explanation</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" width="22.86245353159851%" headers="d0e164 "><strong>08</strong>003</td>
<td align="left" valign="top" width="23.605947955390334%" headers="d0e166 ">Connection not open</td>
<td align="left" valign="top" width="53.53159851301115%" headers="d0e168 ">The <em>hdbc</em> is not in a connected state.</td>
</tr>
<tr><td align="left" valign="top" width="22.86245353159851%" headers="d0e164 "><strong>08</strong>007</td>
<td align="left" valign="top" width="23.605947955390334%" headers="d0e166 ">Connection failure during transaction</td>
<td align="left" valign="top" width="53.53159851301115%" headers="d0e168 ">The connection associated with the <em>hdbc</em> fails
during the processing of the function during the processing of the function
and it cannot be determined whether the requested COMMIT or ROLLBACK occurs
before the failure.</td>
</tr>
<tr><td align="left" valign="top" width="22.86245353159851%" headers="d0e164 "><strong>58</strong>004</td>
<td align="left" valign="top" width="23.605947955390334%" headers="d0e166 ">System error</td>
<td align="left" valign="top" width="53.53159851301115%" headers="d0e168 ">Unrecoverable system error.</td>
</tr>
<tr><td align="left" valign="top" width="22.86245353159851%" headers="d0e164 "><strong>HY</strong>001</td>
<td align="left" valign="top" width="23.605947955390334%" headers="d0e166 ">Memory allocation failure</td>
<td align="left" valign="top" width="53.53159851301115%" headers="d0e168 ">The driver is unable to allocate memory required
to support the processing or completion of the function.</td>
</tr>
<tr><td align="left" valign="top" width="22.86245353159851%" headers="d0e164 "><strong>HY</strong>010</td>
<td align="left" valign="top" width="23.605947955390334%" headers="d0e166 ">Function sequence error</td>
<td align="left" valign="top" width="53.53159851301115%" headers="d0e168 ">SQL_SAVEPOINT_NAME_ROLLBACK or SQL_SAVEPOINT_NAME_RELEASE
is used, but the savepoint name is not established by calling <samp class="codeph">SQLSetConnectAttr()</samp> for
attribute SQL_ATTR_SAVEPOINT_NAME.</td>
</tr>
<tr><td align="left" valign="top" width="22.86245353159851%" headers="d0e164 "><strong>HY</strong>012</td>
<td align="left" valign="top" width="23.605947955390334%" headers="d0e166 ">Transaction operation state that is not valid</td>
<td align="left" valign="top" width="53.53159851301115%" headers="d0e168 ">The value specified for the argument <em>fType</em> is
neither SQL_COMMIT nor SQL_ROLLBACK.</td>
</tr>
<tr><td align="left" valign="top" width="22.86245353159851%" headers="d0e164 "><strong>HY</strong>013 <strong>*</strong></td>
<td align="left" valign="top" width="23.605947955390334%" headers="d0e166 ">Memory management problem</td>
<td align="left" valign="top" width="53.53159851301115%" headers="d0e168 ">The driver is unable to access memory required
to support the processing or completion of the function.</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzadphdapi.htm" title="This topic provides a description of each CLI function.">DB2 UDB CLI functions</a></div>
</div>
</div>
</body>
</html>