Name
SET CONNECTION Statement
Synopsis
The SET CONNECTION statement allows users to switch between several open connections on one or more database servers.
Platform |
Command |
DB2 |
Supported, with limitations |
MySQL |
Not supported |
Oracle |
Not supported |
PostgreSQL |
Not supported |
SQL Server |
Supported, with limitations |
SQL2003 Syntax
SET CONNECTION {DEFAULT | connection_name
}
Keywords
-
connection_name
Names the connection of the current session. If the
connection_name
is different from the current session connection name, then the connection context is switched to theconnection_name
.- DEFAULT
Switches to the default connection from any other connection. This enables rapid switching to the default connection without knowing its name.
Description
This command does not end a connection. Instead, it switches from the current connection to the connection named (making it the current connection), or from the current connection to the default connection. When switching between connections, the old connection becomes dormant (without committing any changes), while the new connection becomes active.
Rules at a Glance
SET CONNECTION does not create a connection. It merely switches your connection context. Use the CONNECT command to create a new connection; use DISCONNECT to terminate a connection.
Programming Tips and Gotchas
The SET CONNECTION command is not frequently used, since many users connect programmatically via ODBC, JDBC, or some other connectivity method. However, on those platforms ...
Get SQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.