tediousjs / node-mssql

Microsoft SQL Server client for Node.js
https://tediousjs.github.io/node-mssql
MIT License
2.23k stars 468 forks source link

use multisubnetfailover in v7 #1366

Closed kalpaj12 closed 2 years ago

kalpaj12 commented 2 years ago

How do I enable multisubnetfailover in v7. I did find a sample code for previous version but this configuration does not work in v7.

Expected behaviour:

Since I have an AGL to prod servers, I need to enable multisubnetfailover, if not, connection fails.

Actual behaviour:

Connection to AGL fails.

Configuration:

{
    "server": "agl.example.com",
    "database": "DB",
    "user": "user",
    "password": "pwd",
    "connectionTimeout": 0,
    "requestTimeout": 0,
    "stream": false,
    "pool": { "max": 10, "min": 0, "idleTimeoutMillis": 30000 },
    "options": {
      "enableArithAbort": true,
      "encrypt": true,
      "trustServerCertificate": true
    }
  }

Software versions

dhensby commented 2 years ago

Adding it to the options should work, as these are passed straight through to the tedious driver.

{
    "server": "agl.example.com",
    "database": "DB",
    "user": "user",
    "password": "pwd",
    "connectionTimeout": 0,
    "requestTimeout": 0,
    "stream": false,
    "pool": { "max": 10, "min": 0, "idleTimeoutMillis": 30000 },
    "options": {
      "enableArithAbort": true,
      "encrypt": true,
+     "multiSubnetFailover": true,
      "trustServerCertificate": true
    }
  }

What is "not working" about it at the moment (any meaningful error)?

kalpaj12 commented 2 years ago

Uhm, I must have missed something last time, this works now, thank you @dhensby! :)