在Node.js中使用msnodesqlv8创建连接池

时间:2018-12-06 06:48:50

标签: node.js connection

const sql = require("msnodesqlv8");
const connectionString ="server=SELT063;Database=AuthDB;username=sa;password=sa;Trusted_Connection=Yes;Driver={SQL Server Native Client 11.0};pool:{max:100,min:1}";
sql.open(connectionString, function (err, conn) {
if(err){
    console.log("Error while connecting to DB :: "+err);
}

var pm = conn.procedureMgr();
pm.setTimeout(2);
sqlParams=[
    {
        "name": "Name",
        "type": "sql.varchar",
        "value": "ans"
    },{
        "name": "mob",
        "type": "sql.varchar",
        "value": "96"
    }];
  pm.callproc('GetUser',[sqlParams[0].value,sqlParams[1].value], function(err, 
results) {      
    if(err){
        console.log("Error in executing procedure :: "+err);
    }
    else{
        console.log('Procedure call success');           
        console.log(results);
    }
  });
})

我想使用msnodesqlv8节点包创建一个连接池。但是我不知道该怎么做。我已经在上面发布了代码。

1 个答案:

答案 0 :(得分:0)

raised the issue,但一周后几乎没有答复。可能最好使用其他具有更好文档并且更活跃的软件包