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

281 lines
16 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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="SQLSetEnvAttr - Set environment attribute" />
<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="rzadpfnsenva" />
<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>SQLSetEnvAttr</title>
</head>
<body id="rzadpfnsenva"><a name="rzadpfnsenva"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">SQLSetEnvAttr - Set environment attribute</h1>
<div><div class="section"></div>
<div class="section"><h4 class="sectiontitle">Purpose</h4> <p><img src="./delta.gif" alt="Start of change" /><samp class="codeph">SQLSetEnvAttr()</samp> sets
an environment attribute for the current environment. An environment attribute
cannot be set if a connection handle has been allocated. In order for the
attribute to apply to the entire CLI environment, the environment
attributes must be in place before this initial connection is made. An <strong>HY</strong>010
error code is returned otherwise.<img src="./deltaend.gif" alt="End of change" /></p>
</div>
<div class="section"><h4 class="sectiontitle">Syntax</h4><pre>SQLRETURN SQLSetEnvAttr (SQLHENV henv,
SQLINTEGER Attribute,
SQLPOINTER Value,
SQLINTEGER StringLength);</pre>
</div>
<div class="section"><h4 class="sectiontitle">Function arguments</h4>
<div class="tablenoborder"><img src="./delta.gif" alt="Start of change" /><table cellpadding="4" cellspacing="0" summary="" width="100%" frame="hsides" border="1" rules="all"><caption>Table 1. SQLSetEnvAttr arguments</caption><thead align="left"><tr><th align="left" valign="top" width="20%" id="d0e51">Data type</th>
<th align="left" valign="top" width="20%" id="d0e53">Argument</th>
<th align="left" valign="top" width="20%" id="d0e55">Use</th>
<th align="left" valign="top" width="40%" id="d0e57">Description</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" width="20%" headers="d0e51 ">SQLHENV</td>
<td align="left" valign="top" width="20%" headers="d0e53 "><em>henv</em></td>
<td align="left" valign="top" width="20%" headers="d0e55 ">Input</td>
<td align="left" valign="top" width="40%" headers="d0e57 ">Environment handle.</td>
</tr>
<tr><td align="left" valign="top" width="20%" headers="d0e51 ">SQLINTEGER</td>
<td align="left" valign="top" width="20%" headers="d0e53 "><em>Attribute</em></td>
<td align="left" valign="top" width="20%" headers="d0e55 ">Input</td>
<td align="left" valign="top" width="40%" headers="d0e57 ">Environment attribute to set. Refer to <a href="#rzadpfnsenva__tbenva">Table 2</a> for more information.</td>
</tr>
<tr><td align="left" valign="top" width="20%" headers="d0e51 ">SQLINTEGER</td>
<td align="left" valign="top" width="20%" headers="d0e53 "><em>StringLength</em></td>
<td align="left" valign="top" width="20%" headers="d0e55 ">Input</td>
<td align="left" valign="top" width="40%" headers="d0e57 ">Length of <em>Value</em> in bytes if the attribute
value is a character string; if <em>Attribute</em> does not denote a string,
then DB2<sup>®</sup> UDB
CLI ignores <em>StringLength</em>.</td>
</tr>
<tr><td align="left" valign="top" width="20%" headers="d0e51 ">SQLPOINTER</td>
<td align="left" valign="top" width="20%" headers="d0e53 "><em>pValue</em></td>
<td align="left" valign="top" width="20%" headers="d0e55 ">Input</td>
<td align="left" valign="top" width="40%" headers="d0e57 ">Appropriate value for <em>Attribute</em>.</td>
</tr>
</tbody>
</table>
<img src="./deltaend.gif" alt="End of change" /></div>
</div>
<div class="section"><h4 class="sectiontitle">Usage</h4>
<div class="tablenoborder"><img src="./delta.gif" alt="Start of change" /><a name="rzadpfnsenva__tbenva"><!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="rzadpfnsenva__tbenva" width="100%" frame="hsides" border="1" rules="all"><caption>Table 2. Environment attributes</caption><thead align="left"><tr><th align="left" valign="top" width="50%" id="d0e130"><em>Attribute</em></th>
<th align="left" valign="top" width="50%" id="d0e133">Contents</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_DATE_FMT</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_FMT_ISO The International Organization for Standardization (ISO)
date format yyyy-mm-dd is used. This is the default.</li>
<li>SQL_FMT_USA The United States date format mm/dd/yyyy is used.</li>
<li>SQL_FMT_EUR The European date format dd.mm.yyyy is used.</li>
<li>SQL_FMT_JIS The Japanese Industrial Standard date format yyyy-mm-dd
is used.</li>
<li>SQL_FMT_MDY The date format mm/dd/yy is used.</li>
<li>SQL_FMT_DMY The date format dd/mm/yy is used.</li>
<li>SQL_FMT_YMD The date format yy/mm/dd is used.</li>
<li>SQL_FMT_JUL The Julian date format yy/ddd is used.</li>
<li>SQL_FMT_JOB The job default is used.</li>
</ul>
</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_DATE_SEP</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_SEP_SLASH A slash ( / ) is used as the date separator. This is the
default.</li>
<li>SQL_SEP_DASH A dash ( - ) is used as the date separator.</li>
<li>SQL_SEP_PERIOD A period ( . ) is used as the date separator.</li>
<li>SQL_SEP_COMMA A comma ( , ) is used as the date separator.</li>
<li>SQL_SEP_BLANK A blank is used as the date separator.</li>
<li>SQL_SEP_JOB The job default is used.</li>
</ul>
</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_DECIMAL_SEP</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_SEP_PERIOD A period ( . ) is used as the decimal separator. This
is the default.</li>
<li>SQL_SEP_COMMA A comma ( , ) is used as the decimal separator.</li>
<li>SQL_SEP_JOB The job default is used.</li>
</ul>
</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_DEFAULT_LIB</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A character value that indicates the default
library that is used for resolving unqualified file references. This is not
valid if the environment is using system naming mode.</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_ENVHNDL_COUNTER</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_FALSE DB2 CLI
does not count the number of times the environment handle is allocated. Therefore,
the first call to free the environment handle and all associated resources.</li>
<li>SQL_TRUE DB2 CLI
keeps a counter of the number of times the environment handle is allocated.
Each time the environment handle is freed, the counter is decremented. Only
when the counter reaches zero does the DB2 CLI actually free the handle and all
associated resources. This allows nested calls to programs using the CLI that
allocate and free the CLI environment handle.</li>
</ul>
</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_ESCAPE_CHAR</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A character value that indicates the escape
character to be used when specifying a search pattern in either SQLColumns(
) or SQLTables( ).</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_FOR_FETCH_ONLY</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_TRUE Cursors are read-only and cannot be used for positioned update
or delete operations. This is the default.</li>
<li>SQL_FALSE Cursors can be used for positioned updates or delete operations.</li>
</ul>
<p>The attribute SQL_ATTR_FOR_FETCH_ONLY can also be set for individual
statements using SQLSetStmtAttr().</p>
</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_JOB_SORT_SEQUENCE</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_TRUE DB2 UDB
CLI uses the sort sequence that has been set for the job.</li>
<li>SQL_FALSE DB2 UDB
CLI uses the default sort sequence, which is *HEX.</li>
</ul>
</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_OUTPUT_NTS</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_TRUE DB2 UDB
CLI uses null termination to indicate the length of output character strings.
This is the default.</li>
<li>SQL_FALSE DB2 UDB
CLI does not use null termination.</li>
</ul>
<p>The CLI functions affected by this attribute are all functions called
for the environment (and for any connections allocated under the environment)
that have character string parameters.</p>
</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_REQUIRE_PROFILE</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_TRUE If in server mode, then a profile and password are required
when running SQLConnect() and SQLDriverConnect() functions.</li>
<li>SQL_FALSE If profile is omitted on the SQLConnect() or SQLDriverConnect()
function, then connection is made using current user profile. This is the
default.</li>
</ul>
</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_SERVER_MODE</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_FALSE DB2 CLI
processes the SQL statements of all connections within the same job. All changes
compose a single transaction. This is the default mode of processing.</li>
<li>SQL_TRUE DB2 CLI
processes the SQL statements of each connection in a separate job. This allows
multiple connections to the same data source, possibly with different user
IDs for each connection. It also separates the changes made under each connection
handle into its own transaction. This allows each connection handle to be
committed or rolled back, without impacting pending changes made under other
connection handles. See <a href="rzadpsqlapd.htm#rzadpsqlapd">Run DB2 UDB CLI in server mode</a> for
more information.</li>
</ul>
</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_SYS_NAMING</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_TRUE DB2 UDB
CLI uses the iSeries system naming mode. Files are qualified using the slash
(/) delimiter. Unqualified files are resolved using the library list for the
job.</li>
<li>SQL_FALSE DB2 UDB
CLI uses the default naming mode, which is SQL naming. Files are qualified
using the period (.) delimiter. Unqualified files are resolved using either
the default library or the current user ID.</li>
</ul>
</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_TIME_FMT</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_FMT_ISO The International Organization for Standardization (ISO)
time format hh.mm.ss is used. This is the default.</li>
<li>SQL_FMT_USA The United States time format hh:mmxx is used, where xx
is a.m. or p.m.</li>
<li>SQL_FMT_EUR The European time format hh.mm.ss is used.</li>
<li>SQL_FMT_JIS The Japanese Industrial Standard time format hh:mm:ss is
used.</li>
<li>SQL_FMT_HMS The hh:mm:ss format is used.</li>
</ul>
</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_TIME_SEP</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_SEP_COLON A colon ( : ) is used as the time separator. This is the
default.</li>
<li>SQL_SEP_PERIOD A period ( . ) is used as the time separator.</li>
<li>SQL_SEP_COMMA A comma ( , ) is used as the time separator.</li>
<li>SQL_SEP_BLANK A blank is used as the time separator.</li>
<li>SQL_SEP_JOB The job default is used.</li>
</ul>
</td>
</tr>
<tr><td valign="top" width="50%" headers="d0e130 ">SQL_ATTR_TRUNCATION_RTNC</td>
<td valign="top" width="50%" headers="d0e133 ">A 32-bit integer value:<ul><li>SQL_TRUE CLI returns SQL_SUCCESS_WITH_INFO in the SQLFetch() and SQLFetchScroll()
return codes if truncation occurs.</li>
<li>SQL_FALSE CLI does not return SQL_SUCCESS_WITH_INFO in the SQLFetch()
and SQLFetchScroll() return codes if truncation occurs. This is the default.</li>
</ul>
</td>
</tr>
<tr><td align="left" valign="top" width="50%" headers="d0e130 ">SQL_ATTR_UTF8</td>
<td align="left" valign="top" width="50%" headers="d0e133 ">A 32-bit integer value: <ul><li>SQL_FALSE Character data is treated as being in the default job coded
character set identifier (CCSID). This is the default.</li>
<li>SQL_TRUE Character data is treated as being in the UTF8 CCSID (1208).</li>
</ul>
</td>
</tr>
</tbody>
</table>
<img src="./deltaend.gif" alt="End of change" /></div>
</div>
<div class="section"><h4 class="sectiontitle">Return codes</h4><ul><li>SQL_SUCCESS</li>
<li>SQL_SUCCESS_WITH_INFO</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 3. SQLSetEnvAttr SQLSTATEs</caption><thead align="left"><tr><th align="left" valign="top" width="25%" id="d0e389">SQLSTATE</th>
<th align="left" valign="top" width="25%" id="d0e391">Description</th>
<th align="left" valign="top" width="50%" id="d0e393">Explanation</th>
</tr>
</thead>
<tbody><tr><td align="left" valign="top" width="25%" headers="d0e389 "><strong>HY</strong>009</td>
<td align="left" valign="top" width="25%" headers="d0e391 ">Parameter value that is not valid</td>
<td align="left" valign="top" width="50%" headers="d0e393 ">The specified <em>Attribute</em> is not supported
by DB2 UDB
CLI. <p>Given specified <em>Attribute</em>value, the value specified for the
argument <em>Value</em> is not supported.</p>
<p>The argument <em>pValue</em> is
a null pointer.</p>
</td>
</tr>
<tr><td align="left" valign="top" width="25%" headers="d0e389 "><strong>HY</strong>010</td>
<td align="left" valign="top" width="25%" headers="d0e391 ">Function sequence error</td>
<td align="left" valign="top" width="50%" headers="d0e393 ">Connection handles are already allocated.</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>