Ivan Ivan - 2 months ago 12
Node.js Question

Accessing a Shared Server with Backslashes in the Address via Node Express

I've been struggling to get Express to work with a shared server looking like this:

53.165.137.28\NAME,94273


I get the following error:

Error: Failed to connect to 53.165.137.28:undefined in 15000ms


I tried escaping using double backslashes "\\", but it doesn't work. Also, using %5C also didn't work.

Note:
I can query this server via SQL Server Management Studio just fine.

What am I missing?

Answer Source

I managed to solve it.

Instead of this:

var dbCofing = {
    user: 'USER',
    password: 'PASS',
    server: '53.165.137.28\\NAME,94273',
    database: 'DATABASE'
}

I used the following:

var dbCofing = {
    user: 'USER',
    password: 'PASS',
    server: '53.165.137.28',
    instanceName: 'NAME',
    port: 94273,
    database: 'DATABASE'
}