Disconnecting Databases

When you are finished accessing a database, use the sqldiscon() function to disconnect it.

Following is the syntax to call sqldiscon():

SYNTAX
int
sqldiscon  ( pldbname )
  char  *pldbname;    /* INPUT */ 

The following sqldiscon() call disconnects the currently connected database with the logical name “customer”:

sqldiscon("customer"); 

NOTE: Work done while a database is connected is not committed when you call sqldiscon(). You commit work using the COMMIT WORK statement before you disconnect the database, or before exiting from your program. Otherwise, the disconnection does not occur and your open transaction is rolled back. Databases do not disconnect until a transaction ends. Therefore, any disconnections pend until the application encounters a COMMIT WORK or ROLLBACK WORK statement or an sqllogout() call (which automatically rolls back all work). If the transaction does not complete and you reconnect the database, the disconnect never actually occurs. For more information on transaction management, see the "Managing Transactions in ESQL" section in this chapter.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095