Closing Databases

From InterBase
Jump to: navigation, search

Go Up to Application Requirements


Once a database is no longer needed, you should close it before the program ends. If you do not, subsequent attempts to use the database may fail or result in database corruption. There are two ways to close a database:

  • Use the DISCONNECT statement to detach a database and close files.
  • Use the RELEASE option with COMMIT or ROLLBACK in a program.

DISCONNECT, COMMIT RELEASE, and ROLLBACK RELEASE perform the following tasks:

  • Close open database files.
  • Close remote database connections.
  • Release the memory that holds database descriptions and InterBase engine-compiled requests.
Note: Closing databases with DISCONNECT is preferred for compatibility with the SQL-92 standard.

For a complete discussion of closing databases, see Working with Databases.