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

SQL Anywhere 11.0.0 » SQL Anywhere Server - Database Administration » Starting and Connecting to Your Database » Connecting to a database


Disconnecting from a database

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

When a database server is started, it assigns a unique connection ID to each new connection to the database server. You can obtain a user's connection-id using the CONNECTION_PROPERTY function to request the connection number. The following statement returns the connection ID of the current connection:


To disconnect from a database (Sybase Central)

  1. Select a database.

  2. Choose File » Disconnect.

To disconnect from a database (SQL)

  • Execute a DISCONNECT statement.

See DISCONNECT statement [ESQL] [Interactive SQL] and DROP CONNECTION statement.

Example 1

The following statement shows how to use the DISCONNECT statement to disconnect the current connection, conn1, in Interactive SQL:

Example 2

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


To disconnect other users from a database (SQL)

  1. Connect to the database as a user with DBA authority.

  2. Use the sa_conn_info system procedure to determine the connection ID of the user you want to disconnect.

  3. Execute a DROP CONNECTION statement.


The following statement drops connection number 4.