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

前端 未结 12 1355
忘掉有多难
忘掉有多难 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:39

    Below code is working for me......

    const sql = require('mssql/msnodesqlv8')
    // config for your database
    var config = {
        driver: 'msnodesqlv8',
        server: 'serverNAme\\SQLEXPRESS', 
        database: 'Learn' , 
        options: {
            trustedConnection: true
        }
    };
    

提交回复
热议问题