Skip to content

DB Close

Type: db-close  ·  Package: Database Activities v1.0.3

Closes the connection to the database and releases its resources. It is the counterpart of DB Connect when you work without body (Option B of the session model).

Closes the connection tied to the session. After that, the session can no longer be used: any later query with it fails. Open connections use resources on the database server, so close them as soon as you are done.

  • If you don’t set session, it closes the session of the enclosing DB Connect body (not needed: the body closes it by itself).
  • Closing a session that was already closed does not raise an error.

None.

ParameterTypeDefaultDescription
sessionZoanDbSession—The session returned by DB Connect.

This activity does not return a value.

DB Connect provider = mysql connectionString = credential("db")["value"] → output: db
DB Query session = db sql = "SELECT * FROM products" → output: products
DB Close session = db
Write Excel Sheet path = "C:\Reports\products.xlsx" data = products
MessageCause and fix
'session' is required and must be a database session.No session was passed (or the variable holds no session) and the activity is not inside a DB Connect body.