Tuesday 23 May 2017

Concurrent Connections to MSSQL w/ msnodesqlv8

I'm building an Angular2/Express/MSSQL/NodeJS app and using msnodesqlv8 as the connection to my backend. I've been able to make connections to my database and return results but in my latest component I'm trying to fire off multiple requests to my API and the sql connections are not playing nicely. I'm pretty sure this has something to do with it being asynchronous.

Using ExpressJS to power my API I've created my endpoints which send SQL requests to my SQL server. I then created 4 different services to http.get those SQL results.

My issue is I think that I'm trying to open too many SQL connections at the same time as I get the following error:

Error: Global connection already exists. Call sql.close() first.

Leading me to believe it's an issue of it being asynchronous. Should I just call my service.getRecords() each time successively in a callback?



via gh0st

No comments:

Post a Comment