(Component Integration Services only) Connects to the specified server and disconnects the connected server.
This syntax is sent to Adaptive Server verbatim. Use this syntax with CIS to create a passthru to a different server:
connect to server_name disconnect [from ASE] [all] [connection_name]
This syntax opens a new JDBC-level connection to Adaptive Server, and does not use CIS. You can specify the arguments in any order. If you do not include arguments, Adaptive Server prompts you for connection parameters:
connect [to ASE engine_name] [database database_name] [as connection_name] [user user_id] [identified by password]]]
This syntax opens a new JDBC-level connection to Adaptive Server. This syntax does not use CIS:
connect using connect_string
is the server to which a passthrough connection is required.
disconnects from the current Adaptive Server.
disconnects from all Adaptive Servers.
disconnects from the specified connection.
connects to the specified engine.
connects to the specified database.
connects to the configured connection.
connects to the user with this ID.
connects using a predetermined connection string.
Establishes a passthrough connection to the server named SYBASE:
connect to SYBASE
Disconnects the connected server:
disconnect
Disconnects from all servers:
disconnect all
connect to specifies the server to which a passthrough connection is required. Passthrough mode enables you to perform native operations on a remote server.
server_name must be the name of a server in the sysservers table, with its server class and network name defined.
When establishing a connection to server_name on behalf of the user, CIS uses one of the following identifiers:
A remote login alias described in sysattributes, if present
The user’s name and password
In either case, if the connection cannot be made to the specified server, Adaptive Server returns an error message.
After making a passthrough connection, CIS bypasses the Transact-SQL parser and compiler when subsequent language text is received. It passes statements directly to the specified server, and converts the results into a form that can be recognized by the Open Client interface and returned to the client program.
To close the connection created by the connect to command, use the disconnect command. You can use this command only after the connection has been made using connect to.
You can abbreviate the disconnect command to disc.
The disconnect command returns an error unless connect to has been previously issued and the server is connected to a remote server.
ANSI SQL – Compliance level: Transact-SQL extension.
Permission to use the connect to command must be explicitly granted by the system administrator. The syntax is:
grant connect to user_name
The system administrator can grant or revoke connect permission to public globally while in the master database. If the system administrator wants to grant or revoke connect to permission for a particular user, the user must be a valid user of the master database, and the system administrator must first revoke permission from public as follows:
use master go revoke connect from public go sp_adduser fred go grant connect to fred go
Values in event and extrainfo columns of sysaudits are:
Event |
Audit option |
Command or access audited |
Information in extrainfo |
---|---|---|---|
90 |
security |
connect to |
|
Commands create existing table, grant
System procedures sp_addserver, sp_autoconnect, sp_helpserver, sp_passthru, sp_remotesql, sp_serveroption