node-odbc icon indicating copy to clipboard operation
node-odbc copied to clipboard

Data source name not found and no default driver

Open bgobi1991 opened this issue 9 years ago • 10 comments

Hi Team,

I got the error when connect the db. Please solve the issue { [Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified] errors: [ { message: '[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified', state: 'IM002' } ], error: '[node-odbc] SQL_ERROR', message: '[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified', state: 'IM002' }

bgobi1991 avatar Sep 22 '15 10:09 bgobi1991

@bgobi1991, Please provide the code you use to open the connection. This type of error is usually an indicator that something is wrong with your connection string.

wankdanker avatar Sep 22 '15 13:09 wankdanker

Hi wankdanker,

Host is replace with my public ip db.open("DRIVER={MicrosoftAccessDriver(*.mdb, *.accdb)};SERVER=host;UID=essl;PWD=essl;DBQ=D:\Biometric\Access DB\eSSLSmartOffice.mdb", function(err) {

console.log(err);

});

bgobi1991 avatar Sep 23 '15 05:09 bgobi1991

The MS Access driver is very touchy. Typically, Microsoft Office installs the 32-bit driver. It does not work with Node.js 64-bit. In order to get it to work, you must have the 64-bit MS Access driver. This unfortunately means you must uninstall MS Office 32-bit first if it is installed on your device. Then you must

a) Install MS Office 64-bit OR b) Install the Access 64-bit driver first, then install MS Office 32-bit again

EDIT: If you're using Node 32-bit, then the regular 32-bit MS Access driver should be fine and the issue is something else.

bzuillsmith avatar Sep 23 '15 06:09 bzuillsmith

Hi bzuillsmith,

Thanks for your reply. I will try this method and let you know the status.

bgobi1991 avatar Sep 23 '15 06:09 bgobi1991

I had this error trying to connect to a DB2 database from a Windows 7 machine.

Try adding a Data Source Name to the connection string, if one is configured on your system. (i.e."DSN=MyDSN;UID=MyDatabase;..."

Worked for me.

zenflow avatar Mar 30 '16 22:03 zenflow

Hello Team, I am getting [Microsoft][ODBC Driver Manager] Data source name is not found and no default driver specified. I am using 32 bit windows 7

and this is my code

const sql = require("msnodesqlv8");

const connectionString = "server=CIMPLICITY;Database=CIMPLICITY;Trusted_Connection=Yes;Driver={SQL Server Native Client 11.0}"; const query = "SELECT * FROM INDUS1";

sql.query(connectionString, query, (err, rows) => { if(err){ throw err; return; } console.log(rows); });

arunrout avatar Jun 22 '18 08:06 arunrout

@arunrout The module you are requiring (msnodesqlv8) is a different module than this (odbc). If you were using odbc your code should look something like:

const db = require('odbc')()
const connectionString = "server=CIMPLICITY;Database=CIMPLICITY;Trusted_Connection=Yes;Driver={SQL Server Native Client 11.0}";

db.open(connectionString, (err) => {
  if (err) {
    throw err;
  }

  db.query('SELECT * FROM INDUS1', (err, rows) => {
    if (err) {
      throw err;
    }

    console.log(rows);
  });
});

wankdanker avatar Jun 22 '18 13:06 wankdanker

Thank you sir

On Fri, Jun 22, 2018 at 6:37 PM, Dan VerWeire [email protected] wrote:

@arunrout https://github.com/arunrout The module you are requiring (msnodesqlv8) is a different module than this (odbc). If you were using odbc your code should look something like:

const db = require('odbc')()const connectionString = "server=CIMPLICITY;Database=CIMPLICITY;Trusted_Connection=Yes;Driver={SQL Server Native Client 11.0}"; db.open(connectionString, (err) => { if (err) { throw err; }

db.query('SELECT * FROM INDUS1', (err, rows) => { if (err) { throw err; }

console.log(rows);

}); });

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/w1nk/node-odbc/issues/97#issuecomment-399436499, or mute the thread https://github.com/notifications/unsubscribe-auth/AgY90olS8-kE0QLw-GcdXYtAxQmnutPZks5t_OwugaJpZM4GBf3V .

arunrout avatar Jul 09 '18 07:07 arunrout

Please let me know what I am missing here in the code

const sql = require('mssql/msnodesqlv8')

const sqlConfig = { user: "user", password: "password", database: "dbname", driver: "msnodesqlv8", server: "server name", port: "1433", options:{ trustedConnection: true } }

    try{
            sql.connect(sqlConfig, function(err){
                if(err)console.log(err)
                const req = new sql.Request();
                req.query("select * from student", function(err,records){
                if(err)console.log(err)
                else console.log(records)
                })
            })
            
        }catch(err){
                console.log("Error in connecting database",err)
        }

ConnectionError: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

niyazhashmi1105 avatar Feb 26 '24 14:02 niyazhashmi1105

@niyazhashmi1105 Looks like you're using mssql/msnodesqlv8. This repo is for node-odbc. Try asking here: https://github.com/tediousjs/node-mssql

wankdanker avatar Feb 26 '24 15:02 wankdanker