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

 

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

If you specify this DBM option additionally when you log onto the Database Manager CLI, then the DBM command for opening an SQL session is implicitly executed (see: sql_connect).

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

Opening an SQL session is successful only if the DBM operator logged on to the Database Manager CLI has the server authorization required for executing the DBM command for opening an SQL session.

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

Note the different meanings of the command with uppercase and lowercase specification.

-uSQL: Specifying the database user with user name and password

-USQL: Specifying a database user’s user key stored in the XUSER file

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

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

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

Log on to the Database Manager CLI as operator OLEG with the password MONDAY, connect to the DEMODB database instance, execute the SQL statement to display the content of the columns database table as 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

Log on to the Database Manager CLI as operator OLEG with the password MONDAY, connect to the DEMODB database instance, execute the SQL statement to display the content of the columns database table for the database user registered under the user keyMOKEY:

>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