Having trouble with node-sqlserver in node.js

Viewed 2499

I am having trouble connecting to a database on a computer on my network using node-sqlserver by Microsoft in node.js. I am using sql server 2008 on a windows 2008 server. I am remotely running my node.js on different machine within the same domain. I think the issue has to do with the connection string.

var sql = require('node-sqlserver');
var conn_str = 'Driver={SQL Server Native Client 10.0};Server=(win08-srv);Database=DB;Trusted_Connection={Yes}';

Also, there should be a user name and password to get into the Database, however this wasn't in the example connection string from the node module.

//open the DB connection
sql.open(conn_str, function (err, conn) {
    if (err) {
        console.log("Error opening the connection!");
    return;
    } else {
        console.log('Connection successful!');
        return;
    }
}); 

Always results in printing Error opening the connection! when run.

3 Answers
Related