SQL SET USER
Statement

 <     >         Connection Statements       Example       Flow Chart       Table of Contents

 

The SQL SET USER statement sets a default user name and user password to be used when connecting to a data source.

UserName (input).  This argument must specify a nonnumeric value.  The value is saved as the default user name.  This argument is optional.  If the argument is to be omitted when a user password is specified, the keyword OMITTED must be specified as a placeholder.

UserPassword (input).  This argument must specify a nonnumeric value.  The value is saved as the default user password.  This argument is optional.

The SQL SET USER statement is optional and is provided for convenience only.  The user name and user password may be specified in the SQL CONNECT DATASOURCE statement or omitted entirely.  The default behavior of InstantSQL is for the driver to prompt for the information if it is not provided.  The user name and user password default values, which are set by the SQL SET USER statement, are used only when the SQL CONNECT DATASOURCE statement omits the corresponding arguments.  (See the SQL CONNECT DATASOURCE statement for more information about connecting to a data source.)

A default user name may be set using the configuration option UserName.  (See the topic InstantSQL Configuration for more information on configuration options.)  An SQL SET USER statement that specifies the UserName argument overrides any default value set with the configuration option for the InstantSQL session in which the SQL SET USER statement is executed.  An SQL SHUTDOWN statement will cause the configured default user name to be restored if another InstantSQL session is initiated by executing any InstantSQL statement.

WARNING  If the password is supplied in an SQL SET USER statement, the password value remains in memory in the default password item until either another SQL SET USER statement or an SQL SHUTDOWN statement is executed.  A password specified in the SQL CONNECT DATASOURCE statement is cleared immediately after it is used by InstantSQL, but it is the responsibility of the COBOL program to clear the data item it used to pass the password to InstantSQL.  It is unknown whether the ODBC driver manager or the ODBC driver keeps a clear text copy of the password in memory.

SQL SET USER Statement Example:

 

           SQL SET USER
               sql-UserName,
               sql-UserPassword.

© Copyright 2000-2020 Micro Focus or one of its affiliates.