Execute Query, Disconnect, Exception

When using “Execute Query”, there isn’t a need to add a “Connect” activity in front as we can establish a connection directly in the “Execute Query” activity itself. However, is it still necessary to add a “Disconnect” activity after executing?

Also, if the flow were to throw an exception prior to a “Disconnect” Activity, will the connection be auto disconnected?

Hi

Welcome to uipath forum

Ofcourse it will once your project completes its execution.
And moreover if the error happens before disconnect probably it might be while accessing the server as you are trying to disconnect once after executing the query

So it Yes

Cheers @don123

Hi @don123

You can Create the Database connection via Connect Activity or its self the Execute Query or other like non Execute Query/Start Transaction.

For Disconnect yes it is necessary to add Disconnect activity it means you are releasing the Database resources, if any exception occurs prior to the Disconnect I would suggest in the catch block try to disconnect the database so that it can release the database used resources.

Thanks

Hi Palaniyappan, thanks for the reply.
Another question i have is after the execute query has been performed, will it Auto disconnect the connection right after the activity or only disconnect when my whole project workflow has ended.

It will not auto disconnect after executing that Execute query activity unless a disconnect is made

It will end after the whole process run is over
Still if you want to remove the resource memory occupied on connecting the database, it is good to use a DISCONNECT activity at the end of the process

Cheers @don123