Here is my code :- I'm using the mssql library in NodeJS
const sql = require('mssql')
async () => {
try {
await sql.connect('Server=localhost,1433;Database=database;User Id=username;Password=password;Encrypt=true')
const result = await sql.queryselect * from mytable where id = ${value}
} catch (err) {
// ... error checks
}
finally{
await sql.close()
}
}
I'm simultaneously executing lots of other queries in my application. My goal is to create a new connection every time using the above code and it should not kill the previous connection or query. Right now it is not killing the previous query but it is using the previous connection which is not closed. How should I disable this? Means I have to ignore the previous connection and make a new one.
I will really appreciate your help on this.
I tried the above code and I expect that it should not use the previous connection. But It is using the previous connection.