Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data source name not found and no default driver #97

Open
bgobi1991 opened this issue Sep 22, 2015 · 10 comments
Open

Data source name not found and no default driver #97

bgobi1991 opened this issue Sep 22, 2015 · 10 comments

Comments

@bgobi1991
Copy link

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' }

@wankdanker
Copy link
Collaborator

@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.

@bgobi1991
Copy link
Author

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);

});

@bzuillsmith
Copy link

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.

@bgobi1991
Copy link
Author

Hi bzuillsmith,

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

@zenflow
Copy link

zenflow commented Mar 30, 2016

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.

@arunrout
Copy link

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);
});

@wankdanker
Copy link
Collaborator

@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);
  });
});

@arunrout
Copy link

arunrout commented Jul 9, 2018 via email

@niyazhashmi1105
Copy link

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

@wankdanker
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants