In my application, I am querying multiple SQL Servers to return some data. 
In my main function, I am iterating through the SQL Servers and on each of 
them, I am iterating through the queries that are supposed to run to fetch 
the data. When querying the SQL Server for data, I am using a connection 
promise returned by the following function. 


function poolIt (sqlQuery,sqlServer,databaseName) {
if(!connection)
{
//sqlServer_temp = sqlServer
//instead of checking if connection is defined
//we have to check if connection is open
var dbConfiguration = {
driver: 'msnodesqlv8',
server: sqlServer,
database: databaseName,
options: {
trustedConnection: true
}
}
connection = sql.connect(dbConfiguration);
}
}

Now when the loop is done for one SQL Server, it should connect to another 
SQL Server. But when the debug mode is on, I see that all the queries are 
running against only one server. I understand that this is because of the 
above function as it is checking if a connection object is available or not 
before creating a new connection. So, my question is on how to kill the 
connection object?  connection.close() is not working and nor does 
sql.close() 

Any help, please ?

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/44521f9c-993a-4e4f-a533-efaba1d7054c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to