PostgreSQL DB Connector in a loop

Hi all,

Actually, I use the PostgreSQL DB Connector in a Recursive loop (to do some lecture in the DB).

I wonder if for each iteration, my connector will be reset, so that the corresponding DB Session is destroyed ?

I do not know how to check this …

Thanks in advanced,

Thanh Thanh

If you use the same database you do not need to reset connector just following nodes.

Hi izaychik63,

The Connector is executed in a Recursive loop, I just want to be sure whether it automatically creates, for each iteration, a new DB Session, and then automatically closes it when passing into the next iteration.

If this is not the case, I’ll be in trouble with too many open DB Session to DB for just one WF execution ?!!!

Thanks in advanced,

Thanh Thanh

Onсe open, connection is not closed, so you can continue to use it. For this reason exclude connector from the loop.

1 Like

There is also the DB Connection Closer node, if you want to explicitly take care of that.

Hello Thanh Thanh,
the DB session is tied to the status of the DB Connector node that creates it. As long as the connector node is executed (green) the connection is opened. Once the node is reset (yellow) or the workflow is closed the connection is destroyed.
So when your DB Connector node is part of the recursive loop body e.g. connected to one one the nodes in the loop via a flow variable connection the node will be re-executed along with all the other nodes in the loop body and thus the connection closed and opened with each loop iteration.
If the connector node is outside of the loop the DB connection stays open while the loop is executing.
Bye
Tobias

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.