Disconnecting from a database

When you are finished working with a database, you can disconnect from it. Sybase IQ also gives you the ability to disconnect other users from a given database; for more information about doing this in Sybase Central, see the online help.

You can obtain the connection-id for a user by using the connection_property function to request the connection number. The following statement returns the connection ID of the current connection:

SELECT connection_property( 'number' )

StepsDisconnecting from a database (Sybase Central)

  1. Open the desired server.

  2. Select the desired database.

  3. On the toolbar, click the Disconnect button.

StepsDisconnecting from a database (SQL)

  1. Execute a DISCONNECT statement.

Example 1

The following statement shows how to use DISCONNECT from Interactive SQL to disconnect all connections:

DISCONNECT ALL

Example 2

The following statement shows how to use DISCONNECT in Embedded SQL:

EXEC SQL DISCONNECT :conn_name

StepsDisconnecting other users from a database (SQL)

  1. Connect to an existing database with DBA authority.

  2. Execute a DROP CONNECTION statement.

Example

The following statement drops the connection with ID number 4.

DROP CONNECTION 4

For more information, see DISCONNECT statement [DBISQL] and DROP CONNECTION statement in Reference: Statements and Options.