tediousjs / node-mssql

Microsoft SQL Server client for Node.js
https://tediousjs.github.io/node-mssql
MIT License
2.23k stars 468 forks source link

Error IM002 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified #1169

Closed luluhoc closed 3 years ago

luluhoc commented 3 years ago

Expected behaviour:

I try to connect and run a query

Actual behaviour:

Can't connect

Configuration:

const sql = require('mssql/msnodesqlv8')
const config = {
  user: 'xxxxxx',
  password: 'xxxxxx',
  server: 'xxxxxx\\SQLX12', 
  database: 'xxxxxx',
  port: 49204,
  options: {
    trustedConnection: true,
  }
};

sql.connect(config, function (err) {

  if (err) console.log(err);

  // create Request object
  var request = new sql.Request();

  // query to the database and get the records
  request.query('select * from tempdb..zIntra45_ChiAffJour', function (err, recordset) {

      if (err) console.log(err)

      // send records as a response
      console.log(recordset);

  });
});

Software versions

dhensby commented 3 years ago

I'm not sure what is causing this, but googling the error I can see some people saying that the ODBC driver is not installed on the client machine. Are you sure your node server has the ODBC driver installed?

dhensby commented 3 years ago

closing due to lack of response