Reputation: 1957
I am using npm-mssql
with nodejs. Can anybody please confirm me if I need to close the database connection manually or is it automatically closed?
I have got some info here but not clear to me. Please help...
Upvotes: 2
Views: 2177
Reputation: 375
It would be closed automatically when the garbage collector works!
Though it's a good practice to close any db connection manually after you are done with it, db connection is a heavy resource so closing it to dispose the occupied resources is always a good idea and best practice.
Not only for db connections, but that should be the case for any heavy resource process, like any other I/O operation.
Upvotes: 3