Previous Topic Next topic Print topic


SET CURRENT SQLID

The SET CURRENT SQLID statement changes the AuthID value stored in the CURRENT SQLID special register.

Invocation

This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared. The value to which special register CURRENT SQLID is set is used as the SQL authorization ID and the implicit qualifier for dynamic SQL statements only if DYNAMICRULES run behavior is in effect. The CURRENT SQLID value is ignored for the other DYNAMICRULES behaviors.

Authorization

In most cases, the CURRENT SQLID value must equal one of the AuthIDs of the session. If one of these session AuthIDs possesses SYSADM authority for the location, then CURRENT SQLID can be set to any valid AuthID within the location.

Syntax

SET CURRENT SQLID = {USER | string-constant | host-variable}

Parameters:

USER Is the special register USER, containing a valid AuthID of the session.
string-constant A character string -- not longer than eight bytes and surrounded by quotes -- identifying a valid AuthID of the session.
host-variable Identifies a host variable containing a character string (not longer than eight bytes) identifying a valid AuthID of the session.

Description

The initial value of the SQL AuthID (SQLID) is established during connection or XDB Server log on. The value specified in the SET CURRENT SQLID statement remains the SQLID until the XDB Server connection is terminated, the SQLID is changed by executing a new SET CURRENT SQLID statement or when a SET LOCATION command is issued. SET LOCATION resets the SQLID to either the Primary AuthID value stored in CONFIG.XDB (if security is off) or the initial Primary AuthID value established during your security login.

The CURRENT SQLID value is the AuthID used for authorization checking on CREATE, GRANT and REVOKE statements. CURRENT SQLID is also used in all other permission situations, such as SELECT statements or any other DML commands.

Additionally, the CURRENT SQLID owns whatever table spaces, databases, storage groups, or synonyms that are created. CURRENT SQLID is also the implicit AuthID qualifier of all table, view, alias, and index names specified in any SQL statements.

Interactive SQL

When you enter an interactive SQL session, the default AuthID becomes the initial value of the CURRENT SQLID special register. The initial value of this register can also be controlled by a SecondaryIDs specified with the SQLWizard Admin Menu commands or a security exit. The CURRENT SQLID special register retains this default value until you issue a SET CURRENT SQLID command -- replacing the initial AuthID value of CURRENT SQLID with another valid primary AuthID.

Changing CURRENT SQLID

During an interactive SQL session, the AuthID value stored within the CURRENT SQLID special register can be changed only by issuing a SET CURRENT SQLID command (or a SET PACKAGESET command). From that point on, the new AuthID value becomes the owner of any databases, tables, or synonyms created within that interactive SQL session. This new AuthID also becomes the implicit qualifier of all table, view, alias, and index names appearing in any SQL statements issued within the interactive SQL session.

Security

Whenever you start an XDB Server session with security off, the Primary AuthID value specified in the Options Utility becomes the CURRENT SQLID for that XDB Server session. If the Primary AuthID specified in the User Profile maps to a SecondaryID, then that SecondaryID becomes the default session SQLID. When security is on and you start an XDB Server session, the UserID entered becomes the CURRENT SQLID. If the UserID entered by the user has a SecondaryID, then the SecondaryID becomes the CURRENT SQLID.

Previous Topic Next topic Print topic