ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzajp_5.4.0.1/rzajpdiagnostics.htm

80 lines
5.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="concept" />
<meta name="DC.Title" content="Use the SQL diagnostics area" />
<meta name="abstract" content="The SQL diagnostics area is used to keep the returned information for an SQL statement that has been run in a program. It contains all the information that is available to you as an application programmer through the SQLCA." />
<meta name="description" content="The SQL diagnostics area is used to keep the returned information for an SQL statement that has been run in a program. It contains all the information that is available to you as an application programmer through the SQLCA." />
<meta name="DC.Relation" scheme="URI" content="rzajpsqlcom.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpupdiag.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpmodeldiag.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpdiagnotes.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpdiagex.htm" />
<meta name="DC.Relation" scheme="URI" content="rzajpdiaglog.htm" />
<meta name="DC.Relation" scheme="URI" content="../db2/rbafzmstgetdiag.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="rzajpdiagnostics" />
<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 the SQL diagnostics area</title>
</head>
<body id="rzajpdiagnostics"><a name="rzajpdiagnostics"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use the SQL diagnostics area</h1>
<div><p>The SQL diagnostics area is used to keep the returned information
for an SQL statement that has been run in a program. It contains all the information
that is available to you as an application programmer through the SQLCA.</p>
<p>There are additional values available to provide more detailed information
about your SQL statement including connection information. More than one condition
can be returned from a single SQL statement. The information in the SQL diagnostics
area is available for the previous SQL statement until the next SQL statement
is run. </p>
<p>To access the information from the diagnostics area, use the GET DIAGNOSTICS
statement. In this statement, you can request multiple pieces of information
at one time about the previously run SQL statement. Each item is returned
in a host variable. You can also request to get a string that contains all
the diagnostic information that is available. Running the GET DIAGNOSTICS
statement does not clear the diagnostics area.</p>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rzajpupdiag.htm">Update applications to use the SQL diagnostics area</a></strong><br />
<span>You might consider changing your applications
to use the SQL diagnostics area instead of the SQL communications area (SQLCA),
because the SQL diagnostics area provides some significant advantages over
the SQLCA.</span></li>
<li class="ulchildlink"><strong><a href="rzajpmodeldiag.htm">iSeries server programming model</a></strong><br />
In the iSeries™ Integrated Language
Environment<sup>®</sup> (ILE), the SQL diagnostics area is scoped to a thread and
an activation group. This means that for each activation group in which a
thread runs SQL statements, a separate diagnostics area exists for the activation.</li>
<li class="ulchildlink"><strong><a href="rzajpdiagnotes.htm">Additional notes on using the SQL diagnostics area</a></strong><br />
In an application program, the SQLCA is replaced with an implicit or stand-alone SQLSTATE variable, which must be declared in the program.</li>
<li class="ulchildlink"><strong><a href="rzajpdiagex.htm">Example: SQL routine exception</a></strong><br />
In this application example, a stored procedure signals an error when an input value is out of range.</li>
<li class="ulchildlink"><strong><a href="rzajpdiaglog.htm">Example: Logging items from the SQL diagnostics area</a></strong><br />
In this example, an application needs to log all errors for security reasons. The log could be used to monitor the health of a system or to monitor for inappropriate use of a database.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpsqlcom.htm" title="This topic describes some concepts and rules that are common to using SQL statements in a host language.">Common concepts and rules for using embedded SQL</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../db2/rbafzmstgetdiag.htm">GET DIAGNOSTICS</a></div>
</div>
</div>
</body>
</html>