Reputation: 837
I am trying to connect mssql server with node.js using mssql package. (https://www.npmjs.org/package/mssql). And I am getting following error. But my server name not xc-pc, my server name is xc-pc\r2.
is there any problem connect to msseql server named instance (r2)? how can I fix this?
connection to xc-pc 2:1433 - failed Error: getaddrinfo ENOTFOUND
Upvotes: 0
Views: 2403
Reputation: 2171
It appears that you are trying to connect to Azure instance. You will need to remove both tcp and the port from the server name as follow:
var config = {
user: '...',
password: '...',
server: 'something.database.windows.net', // Remove tcp and port from the server name
database: '...',
options: {
encrypt: true // Use this if you're on Windows Azure
}
};
Upvotes: 1
Reputation: 1048
You should be able to connect to named instance with this config:
var config = {
user: '...',
password: '...',
server: 'xp-pc',
database: '...',
options: {
instanceName: 'r2'
}
}
You should also try to connect with IP address instead of hostname.
Upvotes: 3