ibm-information-center/dist/eclipse/plugins/i5OS.ic.sqlp_5.4.0.1/rbafydrdaconnect2.htm

163 lines
11 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="Determine connection status" />
<meta name="abstract" content="The CONNECT statement without parameters can be used to determine if the current connection is updatable or read-only for the current unit of work. A value of 1 or 2 will be returned in SQLERRD(3) in the SQLCA or DB2_CONNECTION_STATUS in the SQL diagnostic area." />
<meta name="description" content="The CONNECT statement without parameters can be used to determine if the current connection is updatable or read-only for the current unit of work. A value of 1 or 2 will be returned in SQLERRD(3) in the SQLCA or DB2_CONNECTION_STATUS in the SQL diagnostic area." />
<meta name="DC.subject" content="distributed relational database, determining connection status, committable updates, connection status, determining, SQLCA (SQL Communication Area), SQLERRD field, SQLERRD(4), remote unit of work, distributed unit of work, commitment control, rollback required, rollback, rollback required state, unit of work, rollback required" />
<meta name="keywords" content="distributed relational database, determining connection status, committable updates, connection status, determining, SQLCA (SQL Communication Area), SQLERRD field, SQLERRD(4), remote unit of work, distributed unit of work, commitment control, rollback required, rollback, rollback required state, unit of work, rollback required" />
<meta name="DC.Relation" scheme="URI" content="rbafydistribsupport.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rbafydrdaconnect2" />
<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>Determine connection status</title>
</head>
<body id="rbafydrdaconnect2"><a name="rbafydrdaconnect2"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Determine connection status</h1>
<div><p>The CONNECT statement without parameters can be used to determine
if the current connection is updatable or read-only for the current unit of
work. A value of 1 or 2 will be returned in SQLERRD(3) in the SQLCA or DB2_CONNECTION_STATUS
in the SQL diagnostic area.</p>
<div class="section"><p>The value is determined as follows:</p>
</div>
<div class="section"> <ol><li>Committable updates can be performed on the connection for the unit of
work. <div class="p">This will occur when one of the following is true: <ul><li>The connection is established using remote unit of work (RUW)..</li>
<li>If the connection is established using distributed unit of work (DUW)
and all of the following are true: <ul><li>No connection exists to an application server that does not support distributed
unit of work which can perform committable updates. </li>
<li>One of the following is true: <ul><li>The first committable update is performed on a connection that uses a
protected connection, is performed on the local database, or is performed
on a connection to an ARD program. </li>
<li>There are open updatable local files under commitment control. .</li>
<li>There are open updatable DDM files that use protected connections. </li>
<li>There are two-phase API commitment control resources. </li>
<li>No committable updates have been made.</li>
</ul>
</li>
</ul>
</li>
<li>If the connection is established using distributed unit of work (DUW)
and all of the following are true: <ul><li>No other connections exist to an application server that does not support
distributed unit of work which can perform committable updates. </li>
<li>The first committable update is performed on this connection or no committable
updates have been made. </li>
<li>There are no open updatable DDM files that use protected connections. </li>
<li>There are no open updatable local files under commitment control. </li>
<li>There are no two-phase API commitment control resources. </li>
</ul>
</li>
</ul>
</div>
</li>
<li>No committable updates can be performed on the connection for this unit
of work. <div class="p">This will occur when one of the following is true: <ul><li>If the connection is established using distributed unit of work (DUW)
and one of the following are true: <ul><li>A connection exists to an updatable application server that only supports
remote unit of work. </li>
<li>The first committable update is performed on a connection that uses an
unprotected connection. </li>
</ul>
</li>
<li>If the connection is established using distributed unit of work (DUW)
and one of the following are true: <ul><li>A connection exists to an updatable application server that only supports
remote unit of work. </li>
<li>The first committable update was not performed on this connection. </li>
<li>There are open updatable DDM files that use protected connections. </li>
<li>There are open updatable local files under commitment control. </li>
<li>There are two-phase API commitment control resources. </li>
</ul>
</li>
</ul>
</div>
</li>
</ol>
</div>
<div class="section"><p>The following table summarizes how the connection status is determined
based on the connection type value, if there is an updatable connection to
an application server that only supports remote unit of work, and where the
first committable update occurred. </p>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="all"><caption>Table 1. Summary of determining connection
status values</caption><thead align="left"><tr><th align="left" valign="bottom" width="19.743589743589745%" id="d0e137">Connection method</th>
<th align="left" valign="bottom" width="24.102564102564102%" id="d0e139">Connection Exists to Updatable Remote
Unit of Work Application Server</th>
<th align="left" valign="bottom" width="25.128205128205128%" id="d0e141">Where First Committable Update Occurred <sup>1</sup></th>
<th align="left" valign="bottom" width="31.025641025641026%" id="d0e145">SQLERRD(3) or DB2_CONNECTION_STATUS</th>
</tr>
</thead>
<tbody><tr><td align="center" valign="top" width="19.743589743589745%" headers="d0e137 ">RUW</td>
<td align="center" valign="top" width="24.102564102564102%" headers="d0e139 ">&nbsp;</td>
<td align="center" valign="top" width="25.128205128205128%" headers="d0e141 ">&nbsp;</td>
<td align="center" valign="top" width="31.025641025641026%" headers="d0e145 ">1</td>
</tr>
<tr><td align="center" valign="top" width="19.743589743589745%" headers="d0e137 ">DUW</td>
<td align="center" valign="top" width="24.102564102564102%" headers="d0e139 ">Yes</td>
<td align="center" valign="top" width="25.128205128205128%" headers="d0e141 ">&nbsp;</td>
<td align="center" valign="top" width="31.025641025641026%" headers="d0e145 ">2</td>
</tr>
<tr><td align="center" valign="top" width="19.743589743589745%" headers="d0e137 ">DUW</td>
<td align="center" valign="top" width="24.102564102564102%" headers="d0e139 ">No</td>
<td align="center" valign="top" width="25.128205128205128%" headers="d0e141 ">no updates</td>
<td align="center" valign="top" width="31.025641025641026%" headers="d0e145 ">1</td>
</tr>
<tr><td align="center" valign="top" width="19.743589743589745%" headers="d0e137 ">DUW</td>
<td align="center" valign="top" width="24.102564102564102%" headers="d0e139 ">No</td>
<td align="center" valign="top" width="25.128205128205128%" headers="d0e141 ">one-phase</td>
<td align="center" valign="top" width="31.025641025641026%" headers="d0e145 ">2</td>
</tr>
<tr><td align="center" valign="top" width="19.743589743589745%" headers="d0e137 ">DUW</td>
<td align="center" valign="top" width="24.102564102564102%" headers="d0e139 ">No</td>
<td align="center" valign="top" width="25.128205128205128%" headers="d0e141 ">this connection</td>
<td align="center" valign="top" width="31.025641025641026%" headers="d0e145 ">1</td>
</tr>
<tr><td align="center" valign="top" width="19.743589743589745%" headers="d0e137 ">DUW</td>
<td align="center" valign="top" width="24.102564102564102%" headers="d0e139 ">No</td>
<td align="center" valign="top" width="25.128205128205128%" headers="d0e141 ">two-phase</td>
<td align="center" valign="top" width="31.025641025641026%" headers="d0e145 ">1</td>
</tr>
<tr><td colspan="4" align="left" valign="top" headers="d0e137 d0e139 d0e141 d0e145 "><sup>1</sup>The
terms in this column are defined as: <ul><li><em>No updates</em> indicates no committable updates have been performed,
no DDM files open for update using a protected connection, no local files
are open for update, and no commitment control APIs are registered.</li>
<li><em>One-phase</em> indicates the first committable update was performed
using an unprotected connection or DDM files are open for update using unprotected
connections. </li>
<li><em>Two-phase</em> indicates a committable update was performed on a two-phase
distributed-unit-of-work application server, DDM files are open for update
using a protected connection, commitment control APIs are registered, or local
files are open for update under commitment control. </li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section"><p>If an attempt is made to perform a committable update over a read-only
connection, the unit of work will be placed in a rollback required state.
If an unit of work is in a rollback required state, the only statement allowed
is a ROLLBACK statement; all other statements will result in SQLCODE -918. </p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafydistribsupport.htm" title="DB2 UDB for iSeries supports two levels of distributed relational database.">Distributed support</a></div>
</div>
</div>
</body>
</html>