Node-mssql: Add support for named instances in msnodesql driver

Created on 25 Jan 2014  路  8Comments  路  Source: tediousjs/node-mssql

Most helpful comment

Use this.

var config = {
    user: '...',
    password: '...',
    server: 'serverName',
    database: '...',
    options: {
        instanceName: 'instanceName'
    }
}

All 8 comments

Connecting to serverName\instanceName

var config = {
    user: '...',
    password: '...',
    server: 'serverName\instanceName',
    database: '...'
}

throws and err

ConnectionError: connection to serverName\instanceName:1433 - failed Error:
getaddrinfo ENOTFOUND

Use this.

var config = {
    user: '...',
    password: '...',
    server: 'serverName',
    database: '...',
    options: {
        instanceName: 'instanceName'
    }
}

Still throws:

Error: Failed to lookup instance on serverName : Error: getaddrinfo ENOTFOUND

Change serverName to your server's ip or hostname.

Also make sure SQL Server Browser service is running on the database server, and UDP port 1444 on the database server is reachable.

Changing serverName to ip did the trick. Also it looks like adding domain to serverName works as well.

Thanks Patrik.

I have getting same error too, but I didn't fix. How can I fix this?

var config = {
user: 'sa',
password: 'a',
server: '127.0.0.1',
database: 'ChatServer',
port :'1433'
,
options: {
instanceName: 'R2'
}
}

Hope that will help someone
I was getting following error: Port for SQLEXPRESS not found in ServerName
It appeared that TCP/IP was disabled for sqlexpress - http://www.linglom.com/it-support/enable-remote-connection-on-sql-server-2008-express/

I resolved issue by updating db configuration in sequelize as like this
{
"username": "sa",
"password": "sa@123",
"database": "test",
"host": "localhost",
"dialect": "mssql",
"port": 1433,
"dialectOptions": {
"instanceName": "SQLEXPRESS"
},
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

linvi picture linvi  路  3Comments

mhunting picture mhunting  路  6Comments

PhantomRay picture PhantomRay  路  4Comments

brilvio picture brilvio  路  3Comments

danpetitt picture danpetitt  路  3Comments