CONNECT

Function

Logs off the database and logs on under a new user name and password.

Syntax

CONNECT {txt_lit|_var|_col}[ON-ERROR=procedure[(arg1
[, argi]...)]]

Arguments

txt_lit|_var|_col

Username and password for logon.

ON-ERROR

Procedure to execute logon fails. If no ON‑ERROR procedure is specified and the logon fails, Production Reporting halts with an error message.

You can optionally specify arguments to pass to ON-ERROR. Arguments can be any variable, column, or literal.

Note:

CONNECT is the same as the {connectivity} portion of the Production Reporting command line as follows:

DB2: DB[/username/password]

DDO: DSN[/username/password]

INFORMIX: DB[/username/password][@InformixServer]

ODBC: DSN[/username/password]

ORACLE: [username/password][@OracleServer]

TERADATA: [TDPID/]username[,password]

Description

New connectivity information can be stored in a string variable, column, or literal.

After each CONNECT, the reserved variable $username is set to the new username.

All database cursors or logons are closed before the CONNECT occurs. Do not issue a CONNECT within a SELECT or an SQL paragraph while a query is actively fetching or manipulating data from the database.

Examples

connect  $new-user  on-error=bad-logon($new_user)
connect  'sqr/test'

Caution!

Connectivity information is not encrypted, so beware of security issues.