db.close

function

Library: Database access (OMDB)
Import : omdb.xmd

Declaration
define external function db.close
       value    db.database  database

or

define external function db.close
       value    db.procedure procedure

or

define external function db.close
       value    db.table     table

Argument definitions

database
is a db.database object obtained by opening a connection to a database using one of the db.open functions.
procedure
is the db.procedure object associated with a stored procedure.
table
is a db.table object attached to a database table.


Purpose

Use db.close to explicitly close an existing connection to a database (db.database), a database table (db.table), or a stored procedure (db.procedure). This has the effect of releasing any resources the object was using.

Usage Notes

A connection to a database will automatically close when the db.database OMX variable you created goes out of scope. However, a global db.database OMX variable will not go out of scope until the end of the program.

Closing an unopened db.database object is allowed.

Closing a previously closed db.database object is allowed.

Closing a procedure more than once is allowed.

You are allowed to close a previously closed table.

Example:

Open a connection to a database and then close the connection.

  import "omdb.xmd" prefixed by db.
  global db.database my-database
  
  process
    set my-database to db.open-odbc "DatabaseDemo"
    	. . .
    db.close my-database