Connect to a database environment in interactive mode

You can use the CONNECT . . . USER syntax in SQL statements that you issue in interactive mode. However, DB-Access does not support the USER clause of the CONNECT statement when you connect to a default database server.

When you include the USER 'user identifier' clause in a CONNECT statement in interactive mode, DB-Access prompts you to enter a password.

The following two command examples show how to connect to a database server in interactive mode. The first example uses the CONNECT statement without specifying a user identifier.
dbaccess -nohistory- -

> connect to '@starfish';

Connected.
If you include the USER clause in a CONNECT statement, as the second example shows, DB-Access uses echo suppression to prompt you for a password:
> connect to '@starfish' user 'marae';

ENTER PASSWORD:

Connected.
Restriction: For security reasons, do not enter the password on the screen where it can be seen. Also, do not include the USING password clause in a CONNECT statement when you use DB-Access interactively. If you are in interactive mode and attempt to enter a password before the prompt, an error message is displayed.
You can run the USER clause of a CONNECT statement in a DB-Access file that includes the USER clause. The following example uses a command file that contains a CONNECT statement with a USING clause to connect to a database server:
dbaccess - connfile.sql
Important: An SQL command file that contains the following statement is protected from access by anyone other than the user_id that the USER clause identifies:
CONNECT TO '@dbserver' USER 'user_id' USING password
For UNIX, the following example uses a shell file to connect to a database server. DB-Access prompts you for a password.
dbaccess - - <<\!
connect to '@starfish' user 'marae';
!

ENTER PASSWORD:

Here the delimiting quotation marks preserve letter case in the database server name and in the authorization identifier of the user.