Azure/node-sqlserver

Connections not closed when an error occurs in module level query and queryRaw

jkint opened this issue · 0 comments

Connections are not closed when using the module level query and queryRaw functions. An erroneous query will leave the connection open until it is collected by node.js. This can be a while, resulting in timeouts in Windows Azure SQL Database.

var sql=require('msnodesql');
var assert = require('assert');
var connectionString = "...";

sql.query( connectionString, "This is not a valid query", function( err, results ) {

    // an error will leave the connection open
    if( err ) {
        console.log( err );
        return;
    }

    console.log( results );
});