*Node.js version*: v4.2.6
*OS*: Linux
*Sql server*: 2012

I have used node js to connect mssql database server. Data's are inserted 
into DB continuously 

But we are facing connection pool release exception sometimes.

Find the code snippet and issue in below 

* Code:*

    var sql = require('mssql')
    var dbconfig = {
        server: 'xxxx',
        database: 'xxxx',
        user: 'xxx',
        password: 'xxx',
        port: 'xx'
    };
    try {
        sql.close();
        var connection = sql.connect(dbconfig, function (err) {
    
            if (err) console.log(err);
    
            var sqlquery = '';
            var request = new sql.Request();
            //query to the database and get the repo value
            sqlquery = 'select Repo from verylargetable';
            request.query(sqlquery, function (err, result) {
                if (err) console.log(err)
                var repo = result.recordset[0].Repo;
    
                //query to the database and get the commit value
                sqlquery = "select Commit from verylargetable where Repo='" 
+ repo + "'";
                request.query(sqlquery, function (err, result) {
                    if (err) console.log(err)
                    var comm = result.recordset[0].Commit;
    
                    //query to the database and update the table
                    sqlquery = "UPDATE verylargetable set Repo='" + repo + "', 
WHERE Comm='" + comm + "'";
                    request.query(sqlquery, function (err, result) {
                        if (err) console.log(err)
                        console.log("record(s) updated");
                    });
                });
            });
        });
    }
    catch (e) {
        console.log("===========Exception Occurred==========");
        console.log(e);
        console.log(new Date().toString());
        console.log(
"==========================================================");
    }


*Issue:*
    











* TypeError: Cannot read property 'release' of null at 
ConnectionPool.release 
(/usr/lib/Webhook/node_modules/mssql/lib/base.js:199:14) at 
Request.userCallback 
(/usr/lib/Webhook/node_modules/mssql/lib/tedious.js:608:25) at 
Request._this.callback 
(/usr/lib/Webhook/node_modules/tedious/lib/request.js:47:27) at 
Connection.message 
(/usr/lib/Webhook/node_modules/tedious/lib/connection.js:1401:27) at 
Connection.dispatchEvent 
(/usr/lib/Webhook/node_modules/tedious/lib/connection.js:687:45) at 
MessageIO.<anonymous> 
(/usr/lib/Webhook/node_modules/tedious/lib/connection.js:602:18) at 
emitNone (events.js:67:13) at MessageIO.emit (events.js:166:7) at 
ReadablePacketStream.<anonymous> 
(/usr/lib/EJ2Webhook/node_modules/tedious/lib/message-io.js:102:16) at 
emitOne (events.js:77:13) at ReadablePacketStream.emit (events.js:169:7)*

How to resolve this exception and how to handle exception in query 
execution?

-- 
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/5a1c305a-f3a6-4042-9529-d1d1c95db382%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to