Overview
By default, Etlworks opens every database connection referenced by a flow before the flow starts running. When the flow stops — whether it succeeds or fails — Etlworks closes all connections and coordinates the distributed transaction.
This works well in most cases, but it breaks when the database connection is parametrized with {tokens}. When the flow starts, the token values (global variables) are not available yet, so the flow fails before any transformation runs.
The fix: configure the connection to open when needed — deferred to the moment a transformation actually requests it.
How do I open the connection only when needed?
- Open the database connection.
- Scroll to the Metadata section and enable Open connection when needed.
Limitations
A connection configured with {tokens} does not work in Explorer, Mapping, or test transformation — regardless of the Open connection when needed setting.
Using a tokenized connection across multiple flows or transformations
When a database connection is configured with {tokens} in the URL, username, password, or another field, it must be used with Open connection when needed enabled. Tokens are then resolved at runtime, which lets the same connection be reused in different flows or nested tasks with different values.
However, once the connection is opened (even with Open connection when needed), it is shared with other flows, transformations, and tasks — including nested flows and flows with multiple source-to-destination transformations. To avoid cross-flow contamination:
- Enable Create new database connection for destination if you are loading into different target databases using the same tokenized connection.
- Enable Create new database connection for source if you are extracting from different source databases using the same tokenized connection.
These options force a new connection per execution, so tokens are resolved independently.