Background documentation-uSQL: Opening an SQL Session Locate this document in the navigation structure

 

Several DBM commands require an SQL session before they can be executed.

If you specify this DBM option additionally when logging on to Database Manager CLI, then the DBM command for opening an SQL session with the specified database is implicitly executed (see: sql_connect). However, opening the SQL session is successful only if you have the server permission required to execute the sql_connect command.

If you additionally specify a database user's data, then the SQL session is opened with this data. If you do not specify a database user, the system uses the data of the first DBM operator (system default).

When you exit Database Manager CLI, the SQL session is also ended.

Note the different meanings of the command with uppercase and lowercase spelling:

Use -uSQL to specify the name and the password of the database user

Use -USQL to specify the user key stored in the XUSER file of the database user

When the SQL session is opened, any database name stored under the specified user key is ignored.

Prerequisites

The database user specified with the user name and password, or with a user key, has been created for the database specified under the DBM option -d. Otherwise the DBM command fails.

Structure

-uSQL [<database_user>,<database_user_password>] | -USQL <user_key>

Options

Option

Description

<database_user>

Name of the database user

<database_user_password>

Password of the database user

<user_key>

User key

Example

Using -uSQL

Call Database Manager CLI, log on as the operator OLEG with the password MONDAY, connect to the DEMODB database, and execute the SQL statement to display the content of the columns database table as the database user MONA with the password RED:

>dbmcli -u OLEG,MONDAY -d DEMODB -uSQL MONA,RED db_execute SELECT * FROM columns

OK

CONTINUE

'DBADMIN';'DBADMIN';'ALLOCATORSTATISTIC';'ALLOCATOR';'OPT';'CHAR';'ASCII';40;(null);'YES';'SEL+';(null);(null);(null);(null);1;(null);2;'20060406';'00145007';'20060406';'00145007';'SYSTEM';(null)

'DBADMIN';'DBADMIN';'ALLOCATORSTATISTIC';'USED_BYTES';'OPT';'FIXED';'';20;0;'YES';'SEL+';(null);(null);(null);(null);2;(null);3;'20060406';'00145007';'20060406';'00145007';'SYSTEM';(null)

...

...

Using -USQL

Call Database Manager CLI, logon as the operator OLEG with the password MONDAY, connect to the DEMODB database, and execute the SQL statement to display the content of the columns database table for the database user registered under the user key MOKEY:

>dbmcli -u OLEG,MONDAY -d DEMODB -USQL MOKEY db_execute SELECT * FROM columns

OK

CONTINUE

'DBADMIN';'DBADMIN';'ALLOCATORSTATISTIC';'ALLOCATOR';'OPT';'CHAR';'ASCII';40;(null);'YES';'SEL+';(null);(null);(null);(null);1;(null);2;'20060406';'00145007';'20060406';'00145007';'SYSTEM';(null)

'DBADMIN';'DBADMIN';'ALLOCATORSTATISTIC';'USED_BYTES';'OPT';'FIXED';'';20;0;'YES';'SEL+';(null);(null);(null);(null);2;(null);3;'20060406';'00145007';'20060406';'00145007';'SYSTEM';(null)

...

...

More Information

Utilities, XUSER