When connecting with a database that you may be interacting with multiple times during a process (storing config data on DB instead of excel configs, writing log data to DB etc., extracting/updating data from DB tables) Is it best practice to open the DB connection just once in init state of the Framework and then close it in end state or open and close the connection each time you want to interact with the DB so you aren’t leaving the connection open for potentially a long time?
And also it depends on how long the process runs as well…if its too long then its better to disconnect and connect which does not keep unecessary process live
It is best to open the DB connection just once in the Init and Reuse the connection through out your workflow.
Please ensure that the DB connection is disconnected at some point of time preferably in the End state if you are opening the connection in the init state.