How to connect to SQL Server with windows authentication from Node.JS using mssql module

前端 未结 12 1353
忘掉有多难
忘掉有多难 2020-11-27 13:57

Hi I\'m unable to connect to SQL server that is using windows authentication in node js. I\'m using the mssql module. The error message is :

[ConnectionError         


        
12条回答
  •  一整个雨季
    2020-11-27 14:38

    It worked for me need to install msnodesqlv8 and mssql. also .......:)

        var dbConfig = {
          driver: 'msnodesqlv8',  
          server: "DESKTOP-66LO4I3",
          database: "FutureHealthCareWeb",
          user: "sa",
          password: "pass@123",
          options: {
            trustedConnection: true
        },
        debug: true,
        parseJSON: true
        }; 
        var sql = require('mssql/msnodesqlv8');
    
          sql.connect(dbConfig, function (err) {
          if (err) { console.log(JSON.stringify(err)+'..............') }
          else {
            console.log('Connected')
          }
        }
        );
    

提交回复
热议问题