CONNECT Statement

When connecting to an SQL data source through AcuSQL, use the following syntax for the CONNECT statement:

CONNECT TO server-name [AS connection-name] [USER userid USING passwd]

server-name, connection-name, and userid are alphanumeric literals or host variables defined in an ESQL DECLARE section of Working-Storage. Note that you must place a colon (“:”) before the host variable in the SQL statement.

passwd is a variable-length character string (VARCHAR, in DB2). Note that leading and trailing spaces are not stripped.

The CONNECTION statement attempts to establish a connection with server-name as user userid. The AS connection-name clause assigns the specified name to the connection. This is especially desirable when you want to establish multiple connections.

Example

CONNECT TO big-data AS con1 USER :uid USING :pwd

Note that big-data and con1 are alphanumeric literals. uid and pwd are host variables. A colon must precede host variables (“:”). See the sample programs for a working example

To use Windows authentication when connecting to SQL Server, omit the USER and USING phrases.