Connecting to and Disconnecting from a Server
An application must connect to a server running Microsoft® SQL Server™ before it can work with a SQL Server database. A connection is implemented as a physical connection through a component such as shared memory or a network. An application can open multiple connections to a server.
After a connection is made, the application can execute Transact-SQL statements through the connection. After an application completes all the work that must be done in a SQL Server installation, the application disconnects. This frees all resources held by the connection in the server and terminates the network or shared memory connection between the application and the server.
Connections have these characteristics:
- Are associated with a database, which the application can change as needed. Object references that do not specify a database are assumed to be in the current database associated with the connection.
- Are associated with a specific login account. The login account is associated with user IDs in the SQL Server databases. A connection cannot perform an action in a database that is not permitted to the user ID associated with the login account used by the connection.
- Are the unit of transaction control. If a connection is broken, all uncommitted modifications made by statements executed through the connection are rolled back without affecting uncommitted modifications made through other connections opened by the same application. Locks held by one connection opened by an application prevent the locked rows from being worked on by other connections opened by the same application.
- Have attributes, such as the transaction isolation level, that can be set by the application to specify connection-level behaviors.
(c) 1988-98 Microsoft Corporation. All Rights Reserved.