Closing a Database
Go Up to Working with Databases
When a program is finished with a database, the database should be closed. In SQL, a database can be closed in either of the following ways:
- Issue a
DISCONNECT
to detach a database and close files. - Append a
RELEASE
option to aCOMMIT
orROLLBACK
to disconnect from a database and close files.
DISCONNECT
, COMMIT RELEASE
, and ROLLBACK RELEASE
perform the following tasks:
- Close open database files.
- Disconnect from remote database connections.
- Release the memory that holds database metadata descriptions and InterBase engine-compiled requests.
- Note: Closing databases with
DISCONNECT
is preferred for compatibility with the SQL-92 standard. Do not close a database until it is no longer needed. Once closed, a database must be reopened, and its resources reallocated, before it can be used again.