node-odbc
node-odbc copied to clipboard
Data source name not found and no default driver
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, 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.
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);
});
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.
Hi bzuillsmith,
Thanks for your reply. I will try this method and let you know the status.
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.
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 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);
});
});
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 .
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 Looks like you're using mssql/msnodesqlv8
. This repo is for node-odbc
. Try asking here: https://github.com/tediousjs/node-mssql