79 lines
5.3 KiB
HTML
79 lines
5.3 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="concept" />
|
||
|
<meta name="DC.Title" content="Initialization and termination tasks in a DB2 UDB CLI application" />
|
||
|
<meta name="abstract" content="The initialization task allocates and initializes environment handles and connection handles." />
|
||
|
<meta name="description" content="The initialization task allocates and initializes environment handles and connection handles." />
|
||
|
<meta name="DC.subject" content="initialization, termination, SQLAllocConnect, function, overview, SQLAllocEnv, function, SQLConnect, function, SQLDisconnect, function, SQLFreeConnect, function, SQLFreeEnv, function" />
|
||
|
<meta name="keywords" content="initialization, termination, SQLAllocConnect, function, overview, SQLAllocEnv, function, SQLConnect, function, SQLDisconnect, function, SQLFreeConnect, function, SQLFreeEnv, function" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzadphdovv.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzadpexiniterm.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="rzadphditerm" />
|
||
|
<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>Initialization and termination tasks in a DB2 UDB CLI application</title>
|
||
|
</head>
|
||
|
<body id="rzadphditerm"><a name="rzadphditerm"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Initialization and termination tasks in a DB2 UDB CLI application</h1>
|
||
|
<div><p>The initialization task allocates and initializes environment handles
|
||
|
and connection handles.</p>
|
||
|
<p>The following figure shows the function call sequences for both the initialization
|
||
|
and termination tasks. The transaction processing task in the middle of the
|
||
|
diagram is shown in <a href="rzadphdptran.htm#rzadphdptran">Transaction processing task in a DB2 UDB CLI application</a>.</p>
|
||
|
<div class="fignone" id="rzadphditerm__fgovvb"><a name="rzadphditerm__fgovvb"><!-- --></a><span class="figcap">Figure 1. Conceptual view of initialization and termination
|
||
|
tasks</span><br /><img src="rv3w322.gif" alt="Conceptual view of initialization
and termination task" /><br /></div>
|
||
|
<div class="p">The termination task frees handles. A handle is a variable
|
||
|
that refers to a data object that is controlled by DB2<sup>®</sup> UDB CLI. Using handles frees the application
|
||
|
from having to allocate and manage global variables or data structures, such
|
||
|
as the SQL descriptor area (SQLDA), or SQL communication area (SQLCA) used
|
||
|
in embedded SQL interfaces for IBM<sup>®</sup> Database Management Systems (DBMSs).
|
||
|
An application then passes the appropriate handle when it calls other DB2 UDB
|
||
|
CLI functions. Here are the types of handles: <dl><dt class="dlterm">Environment handle </dt>
|
||
|
<dd>The environment handle refers
|
||
|
to the data object that contains global information regarding the state of
|
||
|
the application. This handle is allocated by calling <samp class="codeph">SQLAllocEnv()</samp>,
|
||
|
and freed by calling <samp class="codeph">SQLFreeEnv()</samp>. An environment handle
|
||
|
must be allocated before a connection handle can be allocated. Only one environment
|
||
|
handle can be allocated per application.</dd>
|
||
|
<dt class="dlterm">Connection handle</dt>
|
||
|
<dd>A connection handle refers
|
||
|
to a data object that contains information that is associated with a connection
|
||
|
that is managed by DB2 UDB CLI. This includes general status information,
|
||
|
transaction status, and diagnostic information. Each connection handle is
|
||
|
allocated by calling <samp class="codeph">SQLAllocConnect()</samp> and freed by calling <samp class="codeph">SQLFreeConnect()</samp>.
|
||
|
An application must allocate a connection handle for each connection to a
|
||
|
database server.</dd>
|
||
|
<dt class="dlterm">Statement handle</dt>
|
||
|
<dd>Statement handles are discussed in <a href="rzadphdptran.htm">Transaction
|
||
|
processing task in a DB2 UDB CLI application</a>.</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="rzadpexiniterm.htm">Example: Initialization and connection in a DB2 UDB CLI application</a></strong><br />
|
||
|
</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzadphdovv.htm" title="Find out how you code your applications to use the DB2 CLI functions.">Write a DB2 UDB CLI application</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|