I am facing problems while execution of multiple stored procedures using npm-mssql package in expressJS.
Currently i have used SingleTon Design pattern for DB configuration and assigned the connection to an global variable called _config
Well to test the _config connection. I have created an separate route, the output of that particular connection string would like this:
Then in our dashboard, we are calling multiple stored procedures as an service, after the first stored procedure call, the global connection parameters would update like:
Then soon after the execution of this SP asynchronously, there is another SP calling and that gets fail in execution and its parameters are updated like this:
If you closely observe this, the last Stored procedures parameters were not cleared and it throws error like:
So manually before execution i was trying to clear the global _config params as:
I tried this clearing of inputs in so many places like in its particular routes and also before and after execution of stored procedure calls, but still not success. What am i doing wrong? In which place i have to clear this params exactly or do i need to close the sql connection. But everything works async, confused where and how to close. Do i need to open this in separate sockets or how? Any suggestions would be very helpful.