Pergunta de entrevista da empresa Optum

How to close connections on exception

Respostas da entrevista

Sigiloso

7 de nov. de 2019

You can use try with resource, so that it will close the connection if it is success or failure.

Sigiloso

31 de mai. de 2019

You can use finally block to close exceptions generally catch block should be fine but you need to make sure that connection gets closed everytime

1