## -uSQL: Opening an SQL Session

### Use

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, 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: specify the database user identified by user name and password

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

See also: Utilities, XUSER

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.

### Syntax

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

### Examples for -uSQL

Call the Database Manager CLI, log on as operator OLEG with 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;(nu

ll);'YES';'SEL+';(null);(null);(null);(null);1;(null);2;'20060406';'00145007';'2

0060406';'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)

...

...

### Example for -USQL

Call the Database Manager CLI, log on as operator OLEG with password MONDAY, connect to the database instance DEMODB, execute the SQL statement to display the contents of the columns database table for the database user registered with 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;(nu

ll);'YES';'SEL+';(null);(null);(null);(null);1;(null);2;'20060406';'00145007';'2

0060406';'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)

...

...