154 lines
8.4 KiB
HTML
154 lines
8.4 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 xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="dc.language" scheme="rfc1766" 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. -->
|
|
<meta name="dc.date" scheme="iso8601" content="2005-09-19" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
|
<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="keywords" content="SET SESSION AUTHORIZATION statement,
|
|
SET SESSION AUTHORIZATION, SQL statements, restrictions, scope" />
|
|
<title>SET SESSION AUTHORIZATION</title>
|
|
<link rel="stylesheet" type="text/css" href="ibmidwb.css" />
|
|
<link rel="stylesheet" type="text/css" href="ic.css" />
|
|
</head>
|
|
<body>
|
|
<a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link -->
|
|
<script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script>
|
|
|
|
|
|
<a name="setsessionauth"></a>
|
|
<h2 id="setsessionauth"><a href="rbafzmst02.htm#ToC_1341">SET SESSION AUTHORIZATION</a></h2><a id="idx3206" name="idx3206"></a><a id="idx3207" name="idx3207"></a>
|
|
<p>The SET SESSION AUTHORIZATION statement changes the value of the SESSION
|
|
USER and USER special registers. It also changes the name of the user profile
|
|
associated with the current thread.</p>
|
|
<a name="wq1790"></a>
|
|
<h3 id="wq1790"><a href="rbafzmst02.htm#ToC_1342">Invocation</a></h3>
|
|
<p>This statement can be embedded within an application program
|
|
or issued interactively. It is an executable statement that can be dynamically
|
|
prepared. It must not be specified in REXX.</p>
|
|
<p>SET SESSION AUTHORIZATION is not allowed in an SQL trigger,
|
|
SQL function, or SQL procedure.</p>
|
|
<a name="wq1791"></a>
|
|
<h3 id="wq1791"><a href="rbafzmst02.htm#ToC_1343">Authorization</a></h3>
|
|
<p>If the authorization name specified on the statement is different than
|
|
the value in the SYSTEM_USER special register, the privileges held by the
|
|
authorization ID of the statement must include the system authority of *ALLOBJ.</p>
|
|
<p>No authorization is required to execute this statement if the authorization
|
|
name specified on the statement is the same as the SYSTEM_USER special register.</p>
|
|
<a name="wq1792"></a>
|
|
<h3 id="wq1792"><a href="rbafzmst02.htm#ToC_1344">Syntax</a></h3>
|
|
<a href="rbafzsetsessionauth.htm#synssa"><img src="c.gif" alt="Click to skip syntax diagram" /></a>
|
|
<pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn392.htm"
|
|
border="0" /></span><a href="#skipsyn-391"><img src="c.gif" alt="Skip visual syntax diagram"
|
|
border="0" /></a> .-=-.
|
|
>>-+-SET SESSION AUTHORIZATION-+--+---+------------------------->
|
|
'-SET SESSION_USER----------'
|
|
|
|
>----+-<span class="italic">authorization-name</span>-+------------------------------------><
|
|
+-SESSION_USER-------+
|
|
+-SYSTEM_USER--------+
|
|
+-USER---------------+
|
|
+-<span class="italic">variable</span>-----------+
|
|
'-<span class="italic">string-constant</span>----'
|
|
|
|
</pre>
|
|
<a name="skipsyn-391" id="skipsyn-391"></a>
|
|
<a name="synssa"></a>
|
|
<h3 id="synssa"><a href="rbafzmst02.htm#ToC_1345">Description</a></h3>
|
|
<dl class="parml">
|
|
<dt class="bold"><var class="pv">authorization-name</var></dt>
|
|
<dd>Identifies an authorization ID that is to be used as the new value for
|
|
the SESSION_USER special register and the runtime authorization ID.
|
|
<p>The authorization ID must be a valid user profile or group user profile that
|
|
exists at the current server. Several system user profiles that do not have
|
|
a user profile handle may not be used. For more information, see the Get Profile
|
|
Handle API.</p>
|
|
</dd>
|
|
<dt class="bold">SESSION_USER <span>or</span> USER</dt>
|
|
<dd>The SESSION_USER special register and the runtime authorization ID are
|
|
set to the USER special register.
|
|
</dd>
|
|
<dt class="bold">SYSTEM_USER</dt>
|
|
<dd>The SESSION_USER special register and the runtime authorization ID are
|
|
set to the SYSTEM_USER special register.
|
|
</dd>
|
|
<dt class="bold"><var class="pv">variable</var></dt>
|
|
<dd>A variable which contains an authorization ID name.
|
|
<p>The variable:
|
|
</p>
|
|
<ul>
|
|
<li>Must be a character-string variable.</li>
|
|
<li>If <var class="pv">variable</var> has an associated indicator variable, the value of
|
|
that indicator variable must not indicate a null value</li>
|
|
<li>Must include an authorization ID that is left justified and must conform
|
|
to the rules for forming an ordinary or delimited identifier.</li>
|
|
<li>Must be padded on the right with blanks.</li>
|
|
<li>Must not be the null value.</li>
|
|
<li>Must not be the keyword USER, SESSION_USER, or SYSTEM_USER.</li></ul>
|
|
</dd>
|
|
<dt class="bold"><var class="pv">string-constant</var></dt>
|
|
<dd>A character constant with an authorization ID.
|
|
</dd>
|
|
</dl>
|
|
<a name="wq1793"></a>
|
|
<h3 id="wq1793"><a href="rbafzmst02.htm#ToC_1346">Notes</a></h3>
|
|
<p><span class="bold">Other effects of SET SESSION AUTHORIZATION:</span> SET SESSION AUTHORIZATION causes the following to occur: </p>
|
|
<ul>
|
|
<li>All cursors that were opened during the unit of work are closed.</li>
|
|
<li>All LOB locators are freed.</li>
|
|
<li>All locks acquired under this unit of work's commitment definition are
|
|
released.</li>
|
|
<li>All prepared statements are destroyed.</li>
|
|
<li>All SQL descriptor areas are deallocated.</li>
|
|
<li>All procedure result sets are cleared.</li>
|
|
<li>The encryption password is reset.</li>
|
|
<li>All open native database files and Integrated File System (IFS)
|
|
files are closed, including sockets, NTC sessions, and memory maps.</li></ul><p class="indatacontent">Other resources are preserved when SET SESSION AUTHORIZATION is executed,
|
|
including declared global temporary tables. It is recommended that all declared
|
|
global temporary tables be dropped or cleared before executing the SET SESSION
|
|
AUTHORIZATION statement.</p><a id="idx3208" name="idx3208"></a>
|
|
<p><span class="bold">SET SESSION AUTHORIZATION restrictions:</span> This statement
|
|
can only be issued as the first statement that results in work that might
|
|
be backed out during the unit of work. The following executable statements
|
|
may be issued prior to executing SET SESSION AUTHORIZATION:</p>
|
|
<ul>
|
|
<li>All SQL transaction statements</li>
|
|
<li>All SQL connection statements</li>
|
|
<li>All SQL session statements</li>
|
|
<li>GET DIAGNOSTICS</li></ul>
|
|
<p>SET SESSION AUTHORIZATION is not allowed if any connections
|
|
other than the connection to the current server exist, including any local
|
|
connections to a non-default activation group.</p>
|
|
<p>SET SESSION AUTHORIZATION is not allowed if any held cursors
|
|
are open or any held locators exist.</p><a id="idx3209" name="idx3209"></a>
|
|
<p><span class="bold">SET SESSION AUTHORIZATION scope:</span> The scope of the
|
|
SET SESSION AUTHORIZATION is the current thread. Other threads in the application
|
|
process are unaffected.</p>
|
|
<a name="wq1794"></a>
|
|
<h3 id="wq1794"><a href="rbafzmst02.htm#ToC_1347">Examples</a></h3>
|
|
<p><span class="italic">Example 1:</span> The following statement sets the SESSION_USER
|
|
special register.</p>
|
|
<pre class="xmp"> <span class="bold">SET SESSION_USER =</span> RAJIV</pre>
|
|
<p><span class="italic">Example 2:</span> Set the session authorization ID (the
|
|
SESSION_USER special register) to be the value of the system authorization
|
|
ID, which is the ID that established the connection on which the statement
|
|
has been issued.</p>
|
|
<pre class="xmp"> <span class="bold">SET SESSION AUTHORIZATION SYSTEM_USER</span></pre>
|
|
<p><a id="idx3210" name="idx3210"></a><a id="idx3211" name="idx3211"></a></p>
|
|
<hr /><br />
|
|
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstsetschema.htm">Previous Page</a> | <a href="rbafzmstsettraj.htm">Next Page</a> | <a href="rbafzmst02.htm#wq1">Contents</a> |
|
|
<a href="rbafzmstindex.htm#index">Index</a> ]
|
|
|
|
<a id="Bot_Of_Page" name="Bot_Of_Page"></a>
|
|
</body>
|
|
</html>
|