DB Connect
DB Connect
Section titled “DB Connect”Type: db-connect · Package: Database Activities v1.0.0 · Output: ZoanDbSession
Opens a connection to a database and returns a session (ZoanDbSession) that is shared by other database activities. It is the starting point of any work with SQL.
How it works
Section titled “How it works”Connect to the motor indicated in provider using the connectionString. You have two modes (see the session model):
- With
body: Activities inside inherit the connection automatically (you don’t configuresession), and the connection closes itself upon completion. - No
body: save the session to an output variable; pass it assessionto the other activities and close it with DB Close.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
provider | list | Motor: sqlserver · postgres · mysql · odbc. |
connectionString | expression | ADO.NET connection string. Supports expressions. |
Optional parameters
Section titled “Optional parameters”Ninguno.
Subflows (lanes)
Section titled “Subflows (lanes)”body optional
Section titled “body optional”Activities to execute with this connection. If omitted, returns the session as output (and you must close it with DB Close).
Output
Section titled “Output”Returns a ZoanDbSession. Pass it as session to the other database activities.
Example
Section titled “Example”DB Connect provider = sqlserver connectionString = = credential("db-erp").ToPlainText() └─ body: DB Query sql = "SELECT TOP 10 * FROM Clientes" → output: clientesRelated activities
Section titled “Related activities”- DB Query / DB Execute / DB Scalar — operate with the session.
- DB Close — close the connection (mode without
body).