sql_connect

Use

You create an SQL session with the database instance for the specified database user.

If you do not specify a user, the system uses the data of the first DBM operator. For this reason, only those database statements for which the first DBM operator is authorized can be executed in this case.

When executing most DBM commands that require an SQL session, the session is opened and closed implicitly. It is therefore unnecessary for you to open an SQL session explicitly.

We only recommend using the DBM command for opening an SQL session if you are dealing with SQL statements that can only be executed by a particular database user, or for performance reasons, if you want to transfer a large number of SQL statements.

In this case, open the SQL session and specify the required database user, execute the required SQL statements (see: sql_execute) and then close the SQL session (see: sql_release).

See also:

Concepts of the Database System, SQL

Prerequisites

?      You have the server authorization DBInfoRead or AccessSQL.

?      You are working in the script or session mode.

Syntax

sql_connect <user_identification>

<user_identification> :: = <user_spec> | <user_type>

<user_spec> :: = <database_user_name>,<database_user_password>

<user_type> :: = user-type=<value>

Options

Option

Description

<database_user_name>

Name of the database user

<database_user_password>

Password of the database user

user-type=<value>

User type, possible values are:

DBM: DBM operator

DBA: database administrator

SAP: database user of the SAP application

Reply

OK

In the event of errors, see Reply Format.

Example

...

       1.      Log on to the Database Manager CLI in session mode as operator OLEG with password MONDAY, connect to the database instance DEMODB:

>dbmcli -u OLEG,MONDAY -d DEMODB

dbmcli on DEMODB>

       2.      Start an SQL session for database user MONA with password RED:

dbmcli on DEMODB>sql_connect MONA,RED

OK