ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaik_5.4.0.1/useedsql.htm

71 lines
4.6 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="Use Extended Dynamic SQL" />
<meta name="abstract" content="Use the ODBC call level interface to dynamically run your SQL statements." />
<meta name="description" content="Use the ODBC call level interface to dynamically run your SQL statements." />
<meta name="DC.Relation" scheme="URI" content="rzaikodbcperfarch.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="useedsql" />
<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>Use Extended Dynamic SQL</title>
</head>
<body id="useedsql"><a name="useedsql"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use Extended Dynamic <span class="keyword">SQL</span></h1>
<div><p>Use the ODBC call level interface to dynamically run your SQL statements.</p>
<div class="section"><p>Traditional <span class="keyword">SQL</span> interfaces
used an embedded <span class="keyword">SQL</span> approach. <span class="keyword">SQL</span> statements were placed directly
in an application's source code, along with high-level language statements
written in C, COBOL, RPG, and other programming languages. The source code
then was precompiled, which translated the <span class="keyword">SQL</span> statements
into code that the subsequent compile step could process. This method sometimes
was referred to as <strong>static <span class="keyword">SQL</span></strong>.
One performance advantage to this approach is that <span class="keyword">SQL</span> statements
were optimized in advance, rather than at runtime while the user was waiting.</p>
</div>
<div class="section"><p>ODBC, however, is a <strong>call level interface</strong> (CLI) that uses
a different approach. Using a CLI, <span class="keyword">SQL</span> statements
are passed to the database management system (DBMS) within a parameter of
a runtime API. Because the text of the <span class="keyword">SQL</span> statement
is never known until runtime, the optimization step must be performed each
time an <span class="keyword">SQL</span> statement
is run. This approach commonly is referred to as <strong>dynamic <span class="keyword">SQL</span></strong>.</p>
</div>
<div class="section"><p>The use of this feature (which is enabled by default) not only
can improve response times, but can improve dramatically server utilization.
This is because optimizing <span class="keyword">SQL</span> queries
can be costly, and performing this step only once always is advantageous.
This works well with a unique feature of DB2<sup>®</sup> UDB for iSeries™. Unlike other DBMSs, it ensures
that statements which are stored in packages are kept up-to-date in terms
of optimization, without administrator intervention. Even if a statement was
prepared for the first time weeks or months ago, DB2 UDB for iSeries automatically regenerates the
access plan when it determines that sufficient database changes require reoptimization.</p>
</div>
<div class="section"><p>For more information on packages and the types of SQL statements
stored in them see <a href="../rzaii/rzaiimst38.htm">SQL
packages</a>. </p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaikodbcperfarch.htm" title="For the iSeries Access for Windows ODBC driver, all of the internal data flows between the client and the server are chained together, and transmit only when needed.">The performance architecture of the iSeries Access for Windows ODBC driver</a></div>
</div>
</div>
</body>
</html>