-842   A CONNECTION TO location-name ALREADY EXISTS

Explanation

One of the following situations occurred:
  • A CONNECT statement identifies a location with which the application process has a private connection, using system-directed access.
  • SQLRULES(STD) is in effect and a CONNECT statement identifies an existing SQL connection.
  • A private connection, using system-directed access, cannot be established because of an existing SQL connection to that location.
  • A CONNECT (type 2) request that includes the USER/USING clause identifies an existing SQL connection.

System action

The statement cannot be processed.

Programmer response

The correction depends on the error, as follows:
  • If the location name is not the intended name, correct it.
  • If SQLRULES(STD) is in effect and the CONNECT statement identifies an existing SQL connection, replace the CONNECT with SET CONNECTION or change the option to SQLRULES(DB2®).
  • If the CONNECT statement identifies an existing private connection, destroy that connection (by using the RELEASE statement in a previous unit of work) before executing the CONNECT statement. If the SQL statements following the CONNECT can be executed using system-directed access, an alternative solution is to change the application to use that method.
  • If system-directed access cannot be used, destroy the conflicting SQL connection (by using the RELEASE statement in a previous unit of work) before executing the SQL statement that requires system-directed access. An alternative solution is to change the application so that only application-directed access is used.
  • Destroy the connection (by using the RELEASE statement in a previous unik of work) before executing the CONNECT statement which includes the USER/USING clause.

Correct the error in the application, rebind the plan or package, and resubmit the job.

SQLSTATE

08002