Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

SET CONNECTION statement [Interactive SQL] [ESQL]

Changes the active database connection.

Syntax
SET CONNECTION [ connection-name ]
connection-name : 
identifier
| string
| hostvar
Remarks

The SET CONNECTION statement changes the active database connection to connection-name. The current connection state is saved, and is resumed when it again becomes the active connection. If connection-name is omitted and there is a connection that was not named, that connection becomes the active connection.

When cursors are opened in Embedded SQL, they are associated with the current connection. When the connection is changed, the cursor names of the previously active connection become inaccessible. These cursors remain active and in position, and become accessible when the associated connection becomes active again.

This SQL statement is not supported for SAP HANA databases.

Privileges

None.

Side effects

None.

Standards
  • ANSI/ISO SQL Standard

    SET CONNECTION is part of optional ANSI/ISO SQL Language Feature F771, "Connection management". Its usage within an Interactive SQL session is not in the standard.

Example

The following example fragment is Embedded SQL.

EXEC SQL SET CONNECTION :conn_name;

From Interactive SQL, set the current connection to the fictitious connection conn1.

SET CONNECTION conn1;