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

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Working with Database Objects » Working with databases

Adding jConnect metadata support to an existing database Next Page

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.

  3. To disconnect from a database (SQL)

For more information, 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 DBA user.

  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.