Results 1 to 2 of 2

Thread: Connection fail to SQL Server using NodeJS mssql msnodesqlv8 from the server ?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    522

    Connection fail to SQL Server using NodeJS mssql msnodesqlv8 from the server ?

    I use windows authentication but when the username didn't have permissions, I got a different error
    Code:
    var sql = require('mssql/msnodesqlv8');
    
    const config = {
        user: 'sa',
        password: 'Coffee',
        server: 'localhost', 
        database: 'Cafe', 
        driver: 'msnodesqlv8',
        port: 1433,
        options: {
          trustedConnection: true,
          enableArithAbort: true
        }    
      };
    
    const conn = new sql.ConnectionPool(config).connect().then(pool => {
        return pool;
      });
    When I connect to the internal server, I get an error:
    ConnectionError: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    at PrivateConnection.callback2 (D:\NodeJS\node_modules\mssql\lib\msnodesqlv8\connection-pool.js:46:17)
    at Immediate.<anonymous> (D:\NodeJS\node_modules\msnodesqlv8\lib\connection.js:41:14)
    at process.processImmediate (node:internal/timers:478:21) {
    code: undefined,
    originalError: [Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified] {
    sqlstate: 'IM002',
    code: 0,
    severity: 0,
    serverName: '',
    procName: '',
    lineNumber: 0
    }
    }
    Last edited by dong; Mar 25th, 2024 at 11:54 PM.

  2. #2
    New Member
    Join Date
    Oct 2024
    Posts
    11

    Re: Connection fail to SQL Server using NodeJS mssql msnodesqlv8 from the server ?

    The error you're encountering usually happens when the necessary ODBC driver for SQL Server isn't installed or isn't configured properly. Make sure you have the correct ODBC driver installed on your system, such as ODBC Driver for SQL Server from Microsoft's official site. Additionally, double-check your configuration for the connection string. Since you're using Windows authentication, setting trustedConnection: true should handle that without needing the username and password. If the issue persists, ensure that the SQL Server is accessible and that you have the proper permissions to connect to it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width