Answer the question
In order to leave comments, you need to log in
How to connect a SQL server database to a node js application?
virtual machine: VMware virtual machine:
win xp with SQL server 2008 installed
physical machine: windows 7 with node.js project
var Connection = require('tedious').Connection;
var Request = require('tedious').Request;
// Create connection to database
var config = {
database: "TestDb",
server: "localhost",
userName: 'TestUser',
password: '12345678aA',
//driver: "msnodesqlv14",
options: {
encrypt: false
}
};
var connection = new Connection(config);
connection.on('connect', function (err) {
if (err) {
console.log(err);
}
else {
queryDatabase();
}
}
);
Answer the question
In order to leave comments, you need to log in
You must specify the address of the virtual machine on which the database is running.
Here, as I understand it, there are two questions.
1. And the virtual machine has support for the second adapter (which is not NAT) - "virtual hosting". Patamushta without this, she can go outside (through NAT, which is always enabled by default), but it is impossible to reach her - from the outside.
2. And in Windows XP, the IP address is manually set (some 192.168.33.10), as well as the subnet mask (some 255.255.255.0)
If this is the case, then this 192.168. (instead of the word localhost).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question